Konu: hangi komutla GRID i tazeleyebilirim
Aşagıdaki kodda
YENİ KAYIT tuşuna basıp kaydı girdikten sonra SAKLA tuşunu kullanıyorum.
Ama grid e dokunmadan GRID deki bilgiler tazelenmiyor.
Tazeleme komutu nedir ?
Teşekkürler.
***********************************************************************
Clear All
Public oForm
oForm = Createobject("bayrak")
oForm.Show(1)
Define Class bayrak As Form
DataSession = 2
Top = 2
Left = 50
Height = 390
Width = 350
Name = "bayrak"
Caption = "Bayrak Kodu"
orecord = .Null.
Add Object lblno As Label With ;
left = 5, Top = 5, Width = 45, Caption = "Kodu :"
Add Object lbladi As Label With ;
left = 5, Top = 30, AutoSize=.T., Caption = "Adı :"
Add Object txtNo As myTextBox With ;
left = 45, Top = 2, Width = 35, ControlSource = "bayrak.no",Enabled = .F.,SelectOnEntry = .T.
Add Object txtAdi As myTextBox With ;
left = 45, Top = 27, Width = 150, ControlSource = "bayrak.adi",Enabled = .F.
Add Object cmdNew as CommandButton With ;
Top = 2, ;
Left = 250, ;
Height = 27, ;
Width = 84, ;
Caption = 'Yeni Kayıt', ;
Enabled = .t.
Add Object cmdSave as CommandButton With ;
Top = 2, ;
Left = 250, ;
Height = 27, ;
Width = 84, ;
Caption = 'Sakla', ;
Visible = .f.
Add Object cmdEdit as CommandButton With ;
Top = 32, ;
Left = 250, ;
Height = 27, ;
Width = 84, ;
Caption = 'Düzelt', ;
Enabled = .t.
Add Object cmdUpdate as CommandButton With ;
Top = 32, ;
Left = 250, ;
Height = 27, ;
Width = 84, ;
Caption = 'Sakla', ;
Visible = .f.
Add Object cmdDelete as CommandButton With ;
Top = 62, ;
Left = 250, ;
Height = 27, ;
Width = 84, ;
Caption = 'Sil', ;
Enabled = .t.
Add Object cmdClose as CommandButton With ;
Top = 92, ;
Left = 250, ;
Height = 27, ;
Width = 84, ;
Caption = 'Kapat'
Add Object grdListe as myGrid
Procedure cmdNew.Click
ppNew()
EndProc
Procedure cmdSave.Click
ppSave()
EndProc
Procedure cmdClose.Click
CLOSE ALL
thisform.Release
EndProc
* Add Object grdOrders As Grid With ;
* Left = 10, Top = 90, Height = 400, Width = 780, ;
* RecordSource = "Orders", ;
* LinkMaster = "Customer", ;
* ChildOrder = "cust_id",;
* RelationalExpr = "cust_id"
Procedure Load
Use bayrak INDEX bayrak1,bayrak2
* In 0
* Use (_samples+"data\orders") In 0
* cursorsetprop("buffering",5,"customer")
* cursorsetprop("buffering",5,"orders")
Endproc
Enddefine
******************************************************************
Define Class myTextBox as TextBox
******************************************************************
Enabled = .f.
DisabledForeColor = Rgb(0,0,0)
SelectOnEntry = .t.
EndDefine
******************************************************************
Procedure ppNew
******************************************************************
With oForm
APPEND BLANK
.txtNo.Enabled = .t.
.txtNo.Value = 0
.txtAdi.Enabled = .t.
.txtAdi.Value = ''
.cmdNew.Visible = .f.
.cmdSave.Visible = .t.
.cmdEdit.Visible = .f.
.cmdDelete.Visible = .f.
* .grdListe.Enabled = .f.
.txtNo.SetFocus()
EndWith
EndProc
******************************************************************
Procedure ppSave
******************************************************************
With oForm
If .txtNo.Value > 0
REPLA no WITH .txtNo.Value
REPLA adi WITH .txtAdi.Value
* Thisform.Refresh()
MessageBox('Kayıt işlemi'+Chr(13)+'başarıyla tamamlandı')
EndIf
.txtNo.Enabled = .f.
.txtAdi.Enabled = .f.
.cmdNew.Visible = .t.
.cmdSave.Visible = .f.
.cmdEdit.Visible = .t.
.cmdDelete.Visible = .t.
* .cmdListe.Click()
* .grdListe.Enabled = .t.
* .grdListe.SetFocus()
EndWith
EndProc
******************************************************************
Define Class myGrid as Grid
******************************************************************
Top = 62
Left = 2
Height = 310
Width = 220
ColumnCount = 2
DeleteMark = .t.
RecordMark = .t.
ReadOnly = .T.
RecordSource = "bayrak"
ScrollBars = 2
GridLineColor = Rgb(192,192,192)
Procedure Init
With this
* Scatter Name This.oRecord Memo
.Column1.Header1.Caption = 'Kodu'
.Column1.Width = 50
.Column2.Header1.Caption = 'Adı'
.Column2.Width = 150
* .Column3.Header1.Caption = 'Yaşı'
* .Column4.Header1.Caption = 'Maaşı'
* .Column4.Width = 100
EndWith
this.SetAll('Enabled',.f.,'textbox')
this.SetAll('DisabledForeColor',0,'textbox')
EndProc
Procedure AfterRowColChange
Lparameters nColIndex
DoDefault(nColIndex)
With oForm
.txtno.Value = No
.txtadi.Value = Adi
* .txtYas.Value = Yas
* .txtMaas.Value = Maas
EndWith
Thisform.Refresh()
EndProc
EndDefine