View Windows
I have a number of windows each are displayed based on a state of a number of digital signals. This works for the 1st couple of signal changes it the stop changing, this occurs when windows are to return to main window. The windows freeze and only navigate amongst themselves, the samplame code is given below:
public view1()
{
InitializeComponent();
a1Controller = new Controller();
sWindow = a1Controller.IOSystem.GetSignal("diP1");
diWnd = (DigitalSignal)sWindow;
this.diWnd.Changed += new SignalChangedEventHandler(diWnd_Changed);
}
void diWnd_Changed(object sender, SignalChangedEventArgs e)
{
this.Invoke(new ABB.Robotics.Controllers.IOSystemDomain.SignalChangedEventHandler(this.UpdateUIw), new Object[] { sender, e });
}
private void UpdateUIw(object sender, SignalChangedEventArgs e)
{
SignalState wState = e.NewSignalState;
float wVal = wState.Value;
if (wVal == 0)
{
this.CloseMe();
}
}
/// <summary>
/// Clean up any resources used by this class
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (!IsDisposed)
{
try
{
if (disposing)
{
//ToDo: Call the Dispose method of all FP SDK instances that may otherwise cause memory leak
if (components != null)
{
components.Dispose();
}
if (a1Controller != null)
{
a1Controller = null;
a1Controller.Dispose();
}
}
}
finally
{
base.Dispose(disposing);
}
}
}
I am using VisualStudio 2008, RAB5.11, and RobotStudio 5.11.
Please assist!
Thanks'
public view1()
{
InitializeComponent();
a1Controller = new Controller();
sWindow = a1Controller.IOSystem.GetSignal("diP1");
diWnd = (DigitalSignal)sWindow;
this.diWnd.Changed += new SignalChangedEventHandler(diWnd_Changed);
}
void diWnd_Changed(object sender, SignalChangedEventArgs e)
{
this.Invoke(new ABB.Robotics.Controllers.IOSystemDomain.SignalChangedEventHandler(this.UpdateUIw), new Object[] { sender, e });
}
private void UpdateUIw(object sender, SignalChangedEventArgs e)
{
SignalState wState = e.NewSignalState;
float wVal = wState.Value;
if (wVal == 0)
{
this.CloseMe();
}
}
/// <summary>
/// Clean up any resources used by this class
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (!IsDisposed)
{
try
{
if (disposing)
{
//ToDo: Call the Dispose method of all FP SDK instances that may otherwise cause memory leak
if (components != null)
{
components.Dispose();
}
if (a1Controller != null)
{
a1Controller = null;
a1Controller.Dispose();
}
}
}
finally
{
base.Dispose(disposing);
}
}
}
I am using VisualStudio 2008, RAB5.11, and RobotStudio 5.11.
Please assist!
Thanks'
0
Comments
-
Hi,try to create a Controller instance which is alive all the time. In this case, create the Controller instance in the main windows, then you can pass it through all the sub-windows.Also, make sure to dispose the signal in the dispose method of the subwindow.Let us know how this goes.BRCarlos Martinez
ABB0 -
Hi'How do I pass the controller instance in the main Window through to the sub-windows?I have have tried disposing the signal but the problem still exists'Many Thanks0
-
This is a simple pseudo-codeclass SubForm : TpsForm{Controller _ctrl;internal Init(Controller ctrl){_ctrl = ctrl;}}class MainForm : TpsForm{Controller _ctrl;MainForm(){_ctrl = new Controller();}void Test(){SubForm f = new SubForm();f.Init(_ctrl);t.ShowMe(this);}}Carlos Martinez
ABB0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings