After you have built your control, you test and debug the control to ensure that it operates as you designed it. To do this, add your control to the Toolbox, add a form to the project, and then add the control to the form. For the GroupCheck scenario, you also add controls to the GroupCheck control, add an event handler for the control's custom events, and then build and run the control.
After you have built your control, you add it to the Toolbox in order to use it.
To add the control to the Toolbox
For this scenario, click the GroupCheck control.
To test and debug your control, you add a form to your project.
To add a form to your project
Ensure that the name of the form is not GroupCheck so that the form's source file does not conflict with the name of your control.
A form is added to your project with the name that you specified and is opened in the Forms Designer.
To test the control, you add the control to a form.
To add your control to a form
The control is added to the center of the form.
To ensure that the GroupCheck control is properly parenting controls that are added to it, you add other WFC controls to the GroupCheck control.
To add other controls to the GroupCheck control
The GroupCheck control contains a custom event called checkedChanged. This event is triggered when the CheckBox control that is contained in the GroupCheck control is either checked or unchecked. To determine whether the event is being triggered properly, you add an event handler for the checkedChanged event to your form.
To add an event handler for the checkedChange event
The Text editor opens to an empty event handler.
To determine whether the checkedChanged event is being triggered, add code to the event handler for the form that displays a message box each time the event is triggered.
To add code for the event handler
MessageBox.show("The checkedChanged event was triggered.");
After you have added the control to a form, added controls to the GroupCheck control, and added an event handler for the control's checkedChanged event, you build and run the project.
To build and run the form
Because you are running your project for the first time and because your project contains two .java files, the Project Properties dialog box is displayed.
For more information about project properties, see Setting Project Options.
While the project is running, you can manipulate the control to determine whether it operates properly.
To test the control at run time
A message box is displayed notifying you that the checkedChanged event was triggered. This event occurs each time the check box’s checked state changes. The controls contained in the GroupCheck control are either enabled or disabled depending on the checked state of the control.
For information on exporting a WFC control as an ActiveX control see Building ActiveX Controls.