PUBLIC go_Form
go_Form=CREATEOBJECT("clsForm")
go_Form.Visible = .T.
go_Form.Show()
READ Events
CLOSE ALL
CLEAR ALL
************
DEFINE CLASS clsForm as Form
AutoCenter = .T.
Width = 420
MinWidth = 420
MaxWidth = 420
Height = 360
MinHeight = 360
MaxHeight = 360
ShowTips = .T.
ADD OBJECT lblLabel as Label WITH Top = 6, Left = 6, Autosize = .T., ;
Caption = "Name", Anchor = 3
ADD OBJECT txtName as TextBox WITH Top = 30, Left = 258, Width = 90, Height = 24, ReadOnly = .T., Anchor = 3, ;
DisabledBackColor = RGB(250, 250, 250), ToolTipText = "Name"
ADD OBJECT txtNumber as TextBox WITH Top = 60, Left = 258, Width = 90, Height = 24, ReadOnly = .T., Anchor = 3, ;
Alignment = 1, DisabledBackColor = RGB(250, 250, 250), ToolTipText = "ID"
ADD OBJECT txtGender as TextBox WITH Top = 90, Left = 258, Width = 90, Height = 24, ReadOnly = .T., Anchor = 3, ;
DisabledBackColor = RGB(250, 250, 250), ToolTipText = "Gender"
ADD OBJECT txtHeight as TextBox WITH Top = 120, Left = 258, Width = 90, Height = 24, ReadOnly = .T., Anchor = 3, ;
DisabledBackColor = RGB(250, 250, 250), Alignment = 1, ToolTipText = "Height"
ADD OBJECT cboBox as ComboBox WITH Top = 30, Left = 6, Width = 240, Height = 24, ;
RowSourceType = 2, RowSource = "csrEmployees", Style = 2, Sorted = .T., ;
Anchor = 3, ToolTipText = "Type name or click down arrow"
PROCEDURE cboBox.Init()
This.Value = csrEmployees.cName
WITH ThisForm
.txtName.Value = csrEmployees.cName
.txtNumber.Value = csrEmployees.iNumber
.txtGender.Value = csrEmployees.cGender
.txtHeight.Value = csrEmployees.nHeight
ENDWITH
This.SetFocus()
ENDPROC
*!* START of procedure that feeds the TextBoxes with their values
PROCEDURE cboBox.Click()
WITH ThisForm
.txtName.Value = csrEmployees.cName
.txtNumber.Value = csrEmployees.iNumber
.txtGender.Value = csrEmployees.cGender
.txtHeight.Value = csrEmployees.nHeight
ENDWITH
ENDPROC
*!* END of the feeding procedure
PROCEDURE cboBox.InterActiveChange()
This.Click()
ENDPROC
PROCEDURE Load()
CREATE CURSOR csrNames (cName c(8),iNumber I, cGender c(1), nHeight N(5,2))
INSERT INTO csrNames VALUES ('Karl', 123, 'M', 1.75)
INSERT INTO csrNames VALUES ('Robert', 124, 'M', 1.80)
INSERT INTO csrNames VALUES ('Luisa', 125, 'F', 1.70)
INSERT INTO csrNames VALUES ('Megan', 126, 'F', 1.68)
INSERT INTO csrNames VALUES ('Georges', 127, 'M', 1.82)
INSERT INTO csrNames VALUES ('Kim', 128, 'F', 1.65)
INSERT INTO csrNames VALUES ('Paul', 129, 'M', 1.85)
INSERT INTO csrNames VALUES ('Corinne', 130, 'F', 1.54)
INSERT INTO csrNames VALUES ('Elisa', 131, 'F', 1.68)
INSERT INTO csrNames VALUES ('John', 132, 'M', 1.72)
INSERT INTO csrNames VALUES ('Frank', 133, 'M', 1.90)
SELECT * FROM csrNames ORDER BY 1 INTO CURSOR csrEmployees
ENDPROC
PROCEDURE Destroy()
USE
ThisForm.Release
CLEAR Events
ENDPROC
ENDDEFINE
************