Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
D Format analogue for the datetime field
Message
From
16/12/2005 08:36:01
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01078457
Message ID:
01078614
Views:
9
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(),{//::}) && Initialize with the current or empty datetime
>		else
>			.value = iif(.lCurrent,date(),{}) && Initialize with the current or empty 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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform