************************************************** *-- Class: cnttimecontrol (d:\vfpclasses\global.vcx) *-- ParentClass: container *-- BaseClass: container *-- 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 **************************************************"Set seconds off" and "set hours to 12" in DE.beforeopentables or form.load.