OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Adding the Control Object Pointer Data Member

Often when you construct a control in a window, you want to keep a pointer to the control in a window object data member.

This is for convenience in accessing the control's member functions. Here's a fragment of a parent window object with the declaration for a pointer to a button control object:

class TMyWindow : public TWindow {
TButton *OkButton;
...
};

Controls that you rarely manipulate, like static text and group boxes, do not need these pointer data members. The following example constructs a group box without a data member and a button with a data member (OkButton):

TMyWindow::TMyWindow(TWindow *parent, const char far *title)
:TWindow(parent, title)
{
new TGroupBox(this, ID_GROUPBOX, "Group box", 10, 10, 100, 100);
OkButton = new TButton(this, IDOK, "OK", 10, 200, 50, 50, true);
}

See Also