oComboForm = CreateObject ("frmComboTest") oComboForm.Show ()The first statement (oComboForm = CreateObject ("frmComboTest")) is the one that performs the creation of the form, and the second one (oComboForm.Show ()) executes a default form's method (Show()) and makes it to appear, which means that the form is activated and visible and all its controls will be activated as well (that's how the combobox appears).
Define Class frmComboTest as Form *------ ----- ------------ -- ---- Height = 80 Width = 210 Name = "frmComboTest" Caption = " Form containing a ComboBox" WindowType = 1 Closable = .T. ControlBox = .T. MaxButton = .F. MinButton = .F. Movable = .T. ZoomBox = .F. SizeBox = .F. AutoCenter = .T. ShowWindow = 0Inside the class definition of that form you add all controls (Add Object) that will be part of it. In our case a combobox (cboMonths) and a commandbutton (cmdCancel). The same way you set the properties for the form (see above), you'll set the properties for the controls you are inserting:
Add Object cboMonths as cPtrComboBox with Top = 25 , ; Left = 10 , ; Width = 80 , ; RowSourceType = 1 , ; RowSource = cMonths , ; ColumnCount = 1 , ; ColumnWidths = "80" , ; Style = 2 , ; DisplayCount = 12 , ; Value = 1and this for the commandbutton:
Add Object cmdCancel as CommandButton with Top = 20 , ; Left = 130 , ; Height = 25 , ; Width = 75 , ; FontName = "Arial" , ; FontSize = 8 , ; Cancel = .T. , ; Caption = "\<Close"All that we've done until now defines the form we want to show and its controls. The next part is to define what will happen when events related to the form and its controls get fired. In this point you define those procedures that will treat those events.
Procedure cmdCancel.Click * --------- ----- ThisForm.Release EndProcIt will release the form and will return control to the line following the oComboForm.Show () statement, will perform a Clear Events and end the program. If you wish, add the MessageBox() line to see what happens.
oComboForm = CreateObject ("frmComboTest") oComboForm.Show () MessageBox ("Form was released and execution control returned to 'here'") Clear EventsThe second one (Procedure cboMonths.Click) will be fired when you click with the mouse in the cboMonths combobox:
Procedure cboMonths.Click * --------- ----- MessageBox ("You selected " + This.List (This.ListIndex) ) EndProcWhen this happens that method will be executed and will show what option in the combobox you selected.
Procedure QueryUnload * ----------- MessageBox ("You pressed the "X" to exit!") ThisForm.cmdCancel.Click NoDefault Return .T. EndProcI'm not sure if this explanation is what you was thinking about, but experiment for a while with that code and try to follow to understand each step described.