PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
**************************************************
*-- Form: form1 (c:\intelisys\form1.scx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 04/17/09 09:24:07 AM
*
DEFINE CLASS form1 AS form
Top = 26
Left = 14
Height = 236
Width = 466
DoCreate = .T.
Caption = "Form1"
oldrecno = 0
newrecno = 0
oldrecvalue = 0
newrecvalue = 0
firsthit = 1
Name = "form1"
ADD OBJECT grid1 AS grid WITH ;
ColumnCount = 3, ;
DeleteMark = .F., ;
GridLines = 3, ;
Height = 200, ;
Left = 27, ;
Panel = 1, ;
ScrollBars = 2, ;
Top = 16, ;
Width = 407, ;
HighlightBackColor = RGB(192,192,192), ;
HighlightStyle = 2, ;
AllowAutoColumnFit = 2, ;
Name = "Grid1", ;
Column1.Width = 74, ;
Column1.Name = "Column1", ;
Column2.Width = 157, ;
Column2.Name = "Column2", ;
Column3.Width = 141, ;
Column3.Name = "Column3"
ADD OBJECT form1.grid1.column1.header1 AS header WITH ;
Caption = "ID", ;
Name = "Header1"
ADD OBJECT form1.grid1.column1.text1 AS textbox WITH ;
BorderStyle = 0, ;
Margin = 0, ;
ForeColor = RGB(0,0,0), ;
BackColor = RGB(255,255,255), ;
Name = "Text1"
ADD OBJECT form1.grid1.column2.header1 AS header WITH ;
Caption = "Company", ;
Name = "Header1"
ADD OBJECT form1.grid1.column2.text1 AS textbox WITH ;
BorderStyle = 0, ;
Margin = 0, ;
ForeColor = RGB(0,0,0), ;
BackColor = RGB(255,255,255), ;
Name = "Text1"
ADD OBJECT form1.grid1.column3.header1 AS header WITH ;
Caption = "Contact", ;
Name = "Header1"
ADD OBJECT form1.grid1.column3.text1 AS textbox WITH ;
BorderStyle = 0, ;
Margin = 0, ;
ForeColor = RGB(0,0,0), ;
BackColor = RGB(255,255,255), ;
Name = "Text1"
PROCEDURE moverecs
With This
If .firsthit = 1
.oldrecno = Recno("gridcursor")
.oldrecvalue = gridcursor.nrec
.firsthit = 2
Else
.newrecno = Recno("gridcursor")
.newrecvalue = gridcursor.nrec
NextRecord = .newrecvalue + 1
Select gridcursor
Goto .oldrecno
Replace gridcursor.nrec With .newrecvalue
Goto .newrecno
Replace gridcursor.nrec With NextRecord
nRecno = 0
Scan
nRecno = nRecno + 1
If nRecno = .newrecvalue And Recno() = .oldrecno
nRecno = nRecno + 1
Loop
Endif
If nRecno = NextRecord And Recno() = .newrecno
nRecno = nRecno + 1
Loop
Endif
Replace gridcursor.nrec With nRecno
Endscan
.grid1.Refresh
.firsthit = 1
Select gridcursor
Seek .newrecvalue
Endif
Endwith
ENDPROC
PROCEDURE QueryUnload
If Select("customers") > 0
Use In customers
Endif
If Select("gridcursor") > 0
Use In gridcursor
Endif
ENDPROC
PROCEDURE Load
Set Default To Home()+"samples\northwind\"
If Select("customers") > 0
Use In customers
Endif
If Select("gridcursor") > 0
Use In gridcursor
Endif
Select 0
Use Home()+"samples\northwind\northwind!customers" Alias customers
Select customers
Select * ;
FROM Home()+"samples\northwind\customers" ;
INTO Cursor gridcursor1 Readwrite
[blue]For x = 1 To 1000
Append From customers
Endfor[/blue]
Select gridcursor1
Select gridcursor1.*, Cast(Recno() As N(10,0)) As NRec ;
FROM gridcursor1 ;
INTO Cursor gridcursor Readwrite
Index On NRec Tag NRec
Set Order To Tag NRec
ENDPROC
PROCEDURE grid1.Init
With This
.RecordSource = "gridcursor"
.RecordSourceType = 1
.column1.ControlSource = "gridcursor.customerid"
.column2.ControlSource = "gridcursor.companyname"
.column3.ControlSource = "gridcursor.contactname"
For Each oColumn In .Columns
Bindevent(oColumn.text1,"dblclick",Thisform,"moverecs")
Next
.Refresh
Go Top
Endwith
ENDPROC
ENDDEFINE
*
*-- EndDefine: form1
**************************************************