A SERVICE OF

logo

control in. If you’re using the control in a dialog box, you need to mix in
TDialog. The code would look something like this:
class MyVbxDialog : public TDialog, public TVbxEventHandler
{
public:
MyVbxDialog(TWindow *parent, char *name)
: TDialog(parent, name),
TWindow(parent, name) {}
DECLARE_RESPONSE_TABLE(MyVbxDialog);
};
Build a response table for the parent, including all relevant events from
your control. Use the EV_VBXEVENTNAME macro to set up the
response for each control event. Response tables are described in greater
detail in Chapter 5.
Create the control’ parent. Y u can either construct the control whens o
you create the parent or allow the parent to construct the control itself,
depending on how the control is being used. This is discussed in further
detail on page 336.
VBX control classes
ObjectWindows provides two classes for use in designing an interface for
VBX controls. These classes are TVbxControl and TVbxEventHandler.
TVbxControl provides the actual interface to the control by letting you:
TVbxControl class
Construct a VBX control object
Get and change control properties
Find the number of control properties and convert property names to
and from property indices
Find the number of control events and convert event names to and from
event indices
Call the Visual Basic 1.0 standard control methods AddItem, Move,
Refresh, and RemoveItem
Get the handle to the control element using the TVbxControl member
function GetHCTL
TVbxControl is derived from the class TControl, which is derived from
TWindow. Thus, TVbxControl acts much the same as any other interface
element based on TWindow.
334
OWL P ogrammer’ Guider s