OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Because a dialog box is created from its resource, you do not use C++ code to specify what it looks like or the controls in it.
Although this use of the resource lets you create the dialog box visually, it makes it harder to manipulate the controls from your application. ObjectWindows overcomes this limitation by letting you associate (connect) controls in a dialog box with interface objects, allowing you to
To associate a control object with a control element, you can define a pointer to a control object as a data member and construct a control object in the dialog box object's constructor. Control classes such as TButton have a constructor that takes a pointer to the parent window object and the control's resource identifier. In the following example, TTestDialog's constructor creates a TButton object from the resource ID_BUTTON:
You can also define your own control class, derived from an existing control class (if you want to provide specialized behavior). In the following example, TBeepButton is a specialized TButton that overrides the default response to the BN_CLICKED notification code. A TBeepButton object is associated with the ID_BUTTON button resource.
Unlike setting up a window object, which requires two steps (construction and creation), associating an interface object with an interface element requires only the construction step. This is because the interface element already exists: it is loaded from the dialog box resource. You just have to tell the constructor which control from the resource to use, using its resource identifier.