OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Setting up controls

You cannot manipulate controls by adding strings to a list box or setting the font of an edit control until the dialog box object's SetupWindow member function executes.

Until TDialog::SetupWindow() has called TWindow::SetupWindow(), the dialog box's controls have not been associated with the corresponding objects. Once they are associated, the objects' HWindow data members are valid for the controls.

In this example, the AddString function is not called until the base class SetupWindow function is called:

class TDerivedDialog : public TDialog
{
public:
TDerivedDialog(TWindow* parent, TResId resId)
:
TDialog(parent, resId), TWindow(parent)
{
listbox = new TListBox(this, IDD_LISTBOX);
}
protected:
TListBox* listbox;
};
void TDerivedDialog::SetupWindow()
{
TDialog::SetupWindow();
listbox->AddString("First entry");
}

See Also