1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
| SET DEFAULT TO HOME(2)+"\Data"
oForm = Createobject('MyForm')
oForm.Show()
Read Events
Define Class myform As Form
DataSession = 2
Top = 0
Left = 0
Height = 362
Width = 485
DoCreate = .T.
Caption = "Sample"
Name = "Form1"
Add Object grid1 As Grid With ;
ColumnCount = 1, ;
Height = 310, ;
Left = 12, ;
Panel = 1, ;
RecordSource = "orders", ;
RowHeight = 96, ;
ScrollBars = 2, ;
Top = 12, ;
Width = 420, ;
Name = "Grid1"
Procedure grid1.BeforeRowColChange
Lparameters nColIndex
Thisform.LockScreen = .T.
Endproc
Procedure grid1.AfterRowColChange
Lparameters nColIndex
Thisform.LockScreen = .F.
Endproc
Procedure Init
With This.grid1.Columns(1)
.AddObject('Container1','myContainer')
.Container1.Visible = .T.
.Bound = .F.
.CurrentControl = "Container1"
.Width = 380
.Sparse = .F.
.Header1.Caption = "Order Info"
Endwith
Endproc
Procedure Load
Use orders In 0
Set Multilocks On
CursorSetProp("Buffering",5,'orders')
Endproc
Procedure QueryUnload
Clear Events
Endproc
Enddefine
Define Class myContainer As Container
Width = 380
Height = 96
Name = "Container1"
Add Object lblorder_id As Label With ;
BackStyle = 0, ;
Caption = "Order_id", ;
Left = 8, ;
Top = 8, ;
Width = 48, ;
Name = "lblOrder_id"
Add Object txtorder_id As TextBox With ;
ControlSource = "orders.order_id", ;
Left = 78, ;
Top = 8, ;
Width = 55, ;
Name = "txtOrder_id"
Add Object lblcust_id As Label With ;
BackStyle = 0, ;
Caption = "Cust_id", ;
Left = 8, ;
Top = 36, ;
Width = 43, ;
Name = "lblCust_id"
Add Object txtcust_id As TextBox With ;
ControlSource = "orders.cust_id", ;
Left = 78, ;
Top = 36, ;
Width = 55, ;
Name = "txtCust_id"
Add Object lblorder_date As Label With ;
BackStyle = 0, ;
Caption = "Order_date", ;
Left = 8, ;
Top = 64, ;
Width = 62, ;
Name = "lblOrder_date"
Add Object txtorder_date As TextBox With ;
ControlSource = "orders.order_date", ;
Left = 78, ;
Top = 64, ;
Width = 73, ;
Name = "txtOrder_date"
Add Object combo1 As ComboBox With ;
BoundColumn = 3, ;
BoundTo = .T.,;
ColumnCount = 3, ;
ColumnWidths = "60,100,40", ;
RowSourceType = 3, ;
RowSource = "select first_name,last_name,emp_id from employee into cursor crsEmployee", ;
ControlSource = "Orders.Emp_id", ;
FirstElement = 1, ;
Height = 24, ;
Left = 186, ;
NumberOfElements = 0, ;
Style = 2, ;
Top = 8, ;
Width = 180, ;
Name = "Combo1"
Add Object command1 As CommandButton With ;
Top = 44, ;
Left = 234, ;
Width = 84, ;
Caption = "Show customer", ;
Name = "Command1"
Procedure command1.Click
Select * From testdata!customer Where cust_id = orders.cust_id
Endproc
Enddefine |