Konu: Her bir recordu birden fazla satırda göstere grid örneği. Çetin Başöz.
Arkadaşlar; Kodu UTM 'den buldum. Forumda benzer bir örnek gördüğümü hatırlamıyorum. Les Pinter 'in benzer bir örneğini bir yerlerde okumuştum ama bu kadar okunaklı ve anlaşılır değildi. Herkesin işine yarayabilir diye düşündüm.
Çetin Üstad, sana sormadım ama umarım hoşgörürsün
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
-------------------------------------------------------------------------------------------------------------
Hayat bir bisiklete binmek gibidir. Pedalı çevirmeye devam ettiğiniz sürece düşmezsiniz. Claude Peppeer
Kusuru söylenmeyen adam, ayıbını hüner sanır. Türk Atasözü