Click or drag to resize

Using standard dialog box to modify data

Overview

The FpRapidData, FpToolCalibration and FpWorkObjectCalibration dialog box take a RapidData reference as argument. When the dialog is opened it allows you to directly operate on the referenced RapidData object, for example modifying a RAPID data variable or calibrate a work object. These dialog boxes are the ones used by the standard ABB applications. They are ready-made and cannot be modified, except for the title.

Creating the dialog box

As with all secondary dialog box, the reference to the dialog should be declared as a class variable. This is to make sure that the reference is available for Dispose. The RapidData reference can be declared locally if it is disposed immediately after use, or else as a class variable. When the dialog has been created the title can be set using the Text property. A Closed event handler should be added to dispose the dialog. All three dialog boxes are created in the same way:

C#
private FpRapidData fpRD;
private RapidData aRapidData;
......
this.aRapidData = this.aController.Rapid.GetRapidData(taskName, moduleName, variableName);
this.fpRD = new FpRapidData(this.aRapidData);
this.fpRD.Text = this.aRapidData.Name;
this.fpRD.Closed += new EventHandler( fpRD_Closed);
this.fpRD.ShowMe(this);
VB
Private ARapidData As RapidData
Friend WithEvents FpRD As FpRapidData
.....
Me.ARapidData = Me.AController.Rapid.GetRapidData(ATaskName, AModuleName, AVariableName)
Me.FpRD = New FpRapidData(Me.ARapidData)
Me.FpRD.Text = Me.ARapidData.Name
AddHandler Me.FpRD.Closed, AddressOf Me.FpRD_Closed
Me.FpRD.ShowMe(Me)
Note Note

Verify that the RapidData is of correct RapidDataType for the dialog before using it, that is, tooldata for the FpToolCalibration dialog box and wobjdata for the FpWorkObjectCalibration dialog box.

Note Note

The FpRapidData dialog box is created with a RapidData as in argument. If the RapidData is an array, an index argument is used to specify which element should be displayed (the first element is 1).

Type checking

When calling the FpToolCalibration or FpWorkObjectCalibration constructor the RapidData value should be type checked before use:

C#
if (this.aRapidData.Value is ToolData)
 {
 this.fpTC = new FpToolCalibration(this.aRapidData);
 ....
 }
VB
 If TypeOf Me.ARapidData.Value Is ToolData Then
 Me.FpTC = New FpToolCalibration(Me.ARapidData)
.....
 End If