The function SetupWindow is one of the virtual functions listed in the Event Frame under virtual functions. You need only select the function and use the right button menu to create this function. |
The virtual function SetupWindow is used to initialize subwindows of a window. In the case of a simple calculator, we would like the program to start with a "0" in the window. To do this use SetupWindow to initialize the TEdit or TStatic window that displays the results.
void CalculatTDLGClient::SetupWindow ()
{
TDialog::SetupWindow();
// INSERT>> Your code here.
_value->SetText("0");
} |
SetupWindow can also be used to initialize listbox windows. In this example, the listbox will eventually contain choices of types of programs that this dll will run.
void RblistboMDIChild::SetupWindow ()
{
TMDIChild::SetupWindow();
RightButtonListBox *rbBox =
TYPESAFE_DOWNCAST(GetFirstChild(),RightButtonListBox);
// INSERT>> Your code here.
rbBox->AddString("first");
rbBox->AddString("second");
rbBox->AddString("third");
} |
void InventoryDlg::SetupWindow ()
{
TDialog::SetupWindow();
// INSERT>> Your code here.
int tabs[]={35,100,125};
_inventory->SetTabStops(3,tabs);
}
|
To get the code for this inventory program click here.