You can add a property to your class that will store the field's name (you can probably just use .cControlSource).
Unbind the control, maybe set the input mask to 99/99/9999 99:99:99.
Have the textbox refresh display the value
* refresh method
this.value = ttoc(eval(this.cControlSource))
Have the valid write the textbox's value to the actual field (replace
* valid method
* first validate the value is good....
* then write the value to the table
replace (this.cControlSource) with ctot(this.value)
>Hi everybody,
>
>I think there is no solution for the problem I'll describe bellow but here it goes anyway.
>
>I have a special textbox class called txtDate. This class has the following code in its Init:
>
>if not dodefault()
> return .f.
>endif
>
>with this
> if empty(.cControlSource)
> .cControlSource = .controlsource
> endif
>
> if empty(.cControlSource)
> if .lDateTime
> .value = iif(.lCurrent,datetime(),{//::})
> else
> .value = iif(.lCurrent,date(),{})
> endif
> endif
>
> if type('.ControlSource') = "C" or .lDateTime
> do case
> case .lDateTime OR type(.controlsource) = "T"
> * we can not set format to R
> .Format = "R"
>
> otherwise
> .format = "D"
> .inputmask = ""
> endcase
> endif
>endwith
>
>
>I use StrictDataEntry property as 0 - Loose and InputMask as =strtran(CHRTRAN(TRANSFORM(DATETIME()),"1234567890","9999999999"),"P","A")
>
>The problem is when I want to use this control for time dataentry. The separators don't stay put...
>
>Any way to solve the problem? I really need a "T" format which would be the same as "D" for datetime.
>
>Thanks in advance.