OWLNext 7.0
Borland's Object Windows Library for the modern age
|
You can construct VBX controls either explicitly or implicitly.
You explicitly construct an object when you call one of the constructors. You implicitly construct an object when you do not call one of the constructors and allow the control to be instantiated and created by its parent.
Explicit construction involves calling either constructor of a VBX control object. This is normally done in the parent's constructor so that the VBX control is constructed and ready when the parent window is created. You can also wait to construct the control until it is needed. (You could do this if you had room for only one control.) In this latter case, you could let the user choose a menu choice or press a button. Then, depending what the user does, you would instantiate an object and display it in an existing interface element.
The following code demonstrates explicit construction using both of the TVbxControl constructors in the constructor of a dialog box object:
Implicit construction takes place when you design your interface element outside your application source code, such as in Resource Workshop. You can use Resource Workshop to add VBX controls to dialog boxes and other interface elements. Then when you instantiate the parent object, the children, such as edit boxes, list boxes, buttons, and VBX controls, are automatically created along with the parent.
The following code demonstrates how the code for this might look. It is important to note, however, that what you don't see in the following code is a VBX control. Instead, the VBX control is included in the dialog resource DIALOG_1. When DIALOG_1 is loaded and created, the VBX control is automatically created.