Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Datepicker in data grid
Message
From
30/12/2010 15:35:54
Alp Berker
Defense Finance and Accounting Services
Indianapolis, Indiana, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Datepicker in data grid
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01494187
Message ID:
01494187
Views:
131
This code allows us to place and bind a date and time picker in the third column of a datagrid. Problem is , the date and time picker will not display bound data until the grid cell is activated. We need to know what property of the datetimepicker is not allowing the data to display in the datagrid cell. Thanks in advance.

================================================

* this class definition allows the addobject method to morph the COM object.
Define Class dtPicker As OleControl
Left = 50 && Command button column
Top = 100 && Command button row
Height = 22 && Command button height
Visible = .F.
format = 3
CustomFormat = "mm-dd-yyyy"

Procedure CloseUp()
mdtObj = Thisform.grdDetail.Column3.dtpPicker.object
Replace dtlRecon1.MnthYr With mdtObj.Value
EndProc
ENDDEFINE

* This code snippet defines the objects and bindings for the grid cells.
With Thisform.grdDetail
.RecordSource = "dtlRecon1"
.RowHeight = 22
For Each oCol In .Columns
intCol = Val(Right(oCol.Name,1))
oCol.header1.Caption = Iif(intCol = 1, "Service", Iif(intCol = 2, "Variance", Iif(intCol = 3, "Month Year", ;
IIF(intCol = 4, "Active","Description"))))
oCol.Width = Iif(Inlist(intCol, 1, 4),75, Iif(InList(intCol,2, 3), 100, 256))
Do Case
Case intCol = 4
oCol.AddObject("cmbActive", "COMBOBOX")
oCol.CurrentControl = "cmbActive"
oCol.ControlSource = "dtlRecon1.ActiveVar"
oCol.cmbActive.RowSource = "ThisForm.cntRecon"
oCol.cmbActive.RowSourceType = 10
Case intCol = 1
oCol.AddObject("cmbService", "COMBOBOX")
oCol.CurrentControl = "cmbService"
oCol.ControlSource = "dtlRecon1.Service"
oCol.cmbService.RowSource = "ServiceTypes.Service"
oCol.cmbService.RowSourceType = 6
Case intCol = 3
oCol.AddObject('dtpPicker', 'dtPicker', 'MSComCtl2.DTPicker.2')
oCol.CurrentControl = "Text1"
Store .T. to oCol.dtpPicker.Visible, oCol.dtpPicker.Enabled
oCol.dtpPicker.ControlSource = "dtlRecon1.MnthYr"
Store .F. to oCol.dtpPicker.Visible, oCol.dtpPicker.Enabled
Case intCol = 2
oCol.text1.Format = "@RK"
oCol.text1.InputMask = "$$$,$$$,999,999.99"
Endcase
oCol.Visible = .T.
Endfor
.Refresh
Endwith
Next
Reply
Map
View

Click here to load this message in the networking platform