Public oForm
oForm = Createobject('SampleForm')
oForm.Show()
Define Class SampleForm As Form
DataSession=2
Height=320
Width=400
Add Object dt1 As dt With ;
left=10,Top= 10,ControlSource='test.BirthDate',ControlType=2
Add Object dt2 As dt With ;
left=10,Top= 60,ControlSource='test.LastSeen'
Add Object dt3 As dt With ;
left=10,Top=110,ControlSource='test.SleepAt',ControlType=3
Add Object dt4 As dt With Left=10,Top=160,ControlType=2,Value=Date()
Add Object dt5 As dt With Left=10,Top=210,Value=Datetime()
Add Object dt6 As dt With Left=10,Top=260,ControlType=3,Value='10:00 AM'
Add Object cmdNext As CommandButton With Left = 250,Top=10,Caption='Next'
Add Object cmdPrev As CommandButton With Left = 250,Top=60,Caption='Previous'
Add Object cmdBrowse As CommandButton With Left = 250,Top=110,Caption='Browse'
Add Object cmdValues As CommandButton With Left = 250,Top=160,Caption='Get Values'
Procedure Load
Set Seconds Off
Set Century On
Create Cursor test (BirthDate d, LastSeen T, SleepAt c(8))
Insert Into test Values (Date(1961,1,19), Datetime(2009,8,14,10,30), '02:10 AM')
Insert Into test Values (Date(1990,6,28), Datetime(2009,8,14,11,30), '22:30')
Insert Into test Values ({},{},'')
Locate
Endproc
Procedure cmdNext.Click
Select test
If !Eof()
Skip
If Eof()
Go Bottom
Endif
Endif
Thisform.Refresh()
Endproc
Procedure cmdPrev.Click
Select test
If !Bof()
Skip -1
If Bof()
Go Top
Endif
Endif
Thisform.Refresh()
Endproc
Procedure cmdBrowse.Click
Select test
Browse
Endproc
Procedure cmdValues.Click
Local lcValues, ix, loControl
lcValues = ''
Set Textmerge To Memvar m.lcValues Noshow
Set Textmerge On
For ix = 1 To 6
loControl = Evaluate('thisform.dt'+Ltrim(Str(m.ix)))
\dt<<m.ix>> [<<TYPE('loControl.Value')>>] : <<loControl.value>>
Endfor
Set Textmerge To
Set Textmerge Off
Messagebox(m.lcValues)
Endproc
Enddefine
Define Class dt As dtControl Of ('d:\foxyclasses\classes\datetimectrls.vcx')
Enddefine