Creating the Setting Window User Interface (UI)
Create an execution file for the interface to set the parameters required to perform internal processing.
Adding a Control
Add the controls required for the form according to the following procedure:
- In Solution Explorer, right-click the form to be edited and select [Display designer].
The form opens. When "Simplified non-stop adjustment" is checked in the FJ processing item creation wizard, the model project includes NormalForm.vb and NonstopForm.vb.
- NormalForm.vb
This is a standard Setting window. This is the form for setting the parameters required for measurement.
- NonstopForm.vb
This is a simplified Setting window that opens during continuous measurement. This is the form for setting editable parameters such as judgement conditions during measurement.
In the sample program, edit NormalForm.vb.
- Select the required control from the toolbox, and arrange it on the form.
The following controls are arranged in the NormalForm.vb form, which is included in the model project:
In the sample program, arrange the following controls in NormalForm.vb, which is included in the model project:
Setting Control Properties
Set the properties for the added controls.
In the sample program, "FigureSetControl", "ValueSetControl", "TabControl", and "GroupPanel" are set.
- Right-click the controls in the form and select [Property].
The Property Edit window opens.
- Set the following items for "FigureSetControl".
FigureSetControl properties
Table: FigureSetControl properties
|
|
|
Set the number according to the figure number in the processing item MS. Specify "0" here because the figure number 0 is defined for model registration in the processing item MS.
Creating Internal Processing (MS)
|
|
|
|
Associate this item with the control of the Image Display window. In the sample program, specify "imgMain", which is the class name of SetupImageWindow which is included in the model form.
|
- Set the following items for "ValueSetControl".
ValueSetControl properties
Table: ValueSetControl properties
|
|
|
Associate this item with the data name in SetUnitData.cpp of the processing item MS. In the sample program, specify "candidateLevel" as defined in SetUnitData.cpp.
Creating Internal Processing (MS)
|
|
|
- Set the following item for "GroupPanel".
Table: GroupPanel property
|
|
|
Specify the title name for GroupPanel. In the sample program, "Measurement condition" is specified.
|
- Set the following item for "TabControl".
Table: TabControl property
|
|
|
Specify this item to increase the number of tabs or to change the tab name.
|
In the sample program, one more tab is added. The tabs are named as follows:
- tabMenu1: Text Model
- tabMenu2: Text Region setting
- tabMenu3: Text Measurement
Initialization
In the "Form_Load" event of the FZ-Main form, write the initialization process of the controls added to the form.
The initialization of the processing item mainly performs the following two kinds of process:
- Initializing Controls
Initialize the controls that require initialization.
- Getting settings values
Reflect the settings data set in the processing item on the UI controls.
Use the UnitDataN/UnitDataS() API to get the settings data. The data name set for the argument is the one that is specified in the MS external interface (UnitData.cpp).
When custom controls are used, data getting, data setting, and data range checks can be automatically performed by associating the data names with those set in the MS item in the custom control properties setting. In that case, the process above (such as getting the settings data) is unnecessary.
Since custom controls are used in the sample program, the process of getting the data is not written. Settings relating to image display and tab control are performed.
Writing the Code for Added Components
For a control added to the form, write the process to be executed upon occurrence of the event. In the sample program, the process to be executed when switching tabs is written.
Sample Program
|
When switching tabs, the control is copied to the new tab.
For a control common to the form, such as [OK], prepare only one control on the form and move it when switching tabs to reduce the number of controls on the form.
|
|
For the [Model] tab and the [Region setting] tab, the same control is used in different property settings respectively. In that case, copy the control and change property settings.
|
Building a Program
Execute [Build] - [Build solution] from the menu, and an execution file is created. If an error occurs during building, correct the error.