Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help using Date Time picker
Message
From
27/09/1999 15:26:37
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
27/09/1999 14:04:53
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00269496
Message ID:
00269576
Views:
14
>Hi.
>
>I'm trying to use a Date & Time picker in a grid.
>
>When i put the control in the grid, it doesn't update data to the bound field in the database. Also I can't move to the cell with the D&T picker using TAB i have to use my mouse to access it.
>
>I have the control set to the DateTimePicker control, Sparse set to .f.
>
>Thanks


Sergio,
DateTimePicker control is awful for binding to Fox datetime data. Instead use a container with two controls :
**************************************************
*-- Class:        cnttimecontrol
*-- ParentClass:  container
*-- BaseClass:    container
*-- Time Stamp:   09/04/99 12:42:00 PM
*-- Control to get a time in AM, PM notation
*
Define CLASS cnttimecontrol AS container

  Width = 78
  Height = 23
  BackStyle = 0
  BorderWidth = 0
  Name = "cnttimecontrol"

*-- Holds control source
  ControlSource = .F.


  Add OBJECT txttime AS textbox_ WITH ;
    ControlSource = "", ;
    Left = 0, ;
    TabIndex = 11, ;
    Top = 0, ;
    Width = 77, ;
    loverridewidth = .T., ;
    Name = "txtTime"


  Add OBJECT oletime AS olecontrol WITH ;
    Top = 0, ;
    Left = 0, ;
    Height = 20, ;
    Width = 77, ;
    Visible = .F., ;
    Name = "OleTime"


  Procedure Init
  With this
    .txttime.controlsource = .Controlsource
    .txttime.init()
    .oletime.Init()
  Endwith
Endproc


  Procedure txttime.GotFocus
  Nodefault
  This.visible = .f.
  With this.Parent.oletime
    .visible = .t.
    .Setfocus()
  Endwith
Endproc


  Procedure oletime.Init
  This.Second	= 0
  With this.Parent.txttime
    If !empty(.value)
      This.Hour	= hour(  ctot(dtoc(date())+" "+.value))
      This.Minute = minute(ctot(dtoc(date())+" "+.value))
    Else
      This.Hour	= 0
      This.Minute = 0
    Endif
  Endwith
Endproc


  Procedure oletime.LostFocus
  This.visible = .f.
  With this.Parent.txttime
    .value = ttoc(ctot(dtoc(date())+;
      " "+padl(this.hour,2,"0") + ;
      ":"+ padl(this.minute,2,"0")),2)
    .visible = .t.
    .valid()
    .refresh()
  Endwith
Endproc


Enddefine
*
*-- EndDefine: cnttimecontrol
**************************************************
Oletime is DT control. I never used this in a grid but I think should work. Lemme know too.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform