Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loose StrictDateEntry
Message
 
 
À
31/01/2005 09:50:14
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
00981831
Message ID:
00982246
Vues:
52
>>>>The problem here that this format is set('date') dependent. What if I'm using 01-01-2004 format? Also AA allows to enter any letter, and I need to allow only AM or PM. Moreover, it depends, am I using military time format or not.
>>>
>>>You're probably using the 24-hour format hh:mm; the military time is hhmm (without the colon).
>>>
>>>I sometimes wish AM/PM was never invented... it's so ridiculously illogical.
>>
>>Thanks for clarifying. We are using full notation here with AM/PM. And it looks like this little big or feature of VFP would not allow me to build this custom class I promised my colleagues. It works for date fields, but doesn't work for datetime. What a pity! :(
>
>I've seen such a custom class on one of my previous jobs - and it had the time part chopped into three fields - hours, minutes, am/pm, which were handled separately and the datetime value was composed from them programmatically. The hour and minute part were spinners, and for AM/PM I don't remember what was there, but I think there was a "@M AM/PM" inputmask and a fake spinner to switch by mouse. Whoever did it probably took all day, but it was then heavily used in reporting, to enter time intervals. People just wanted to know the sales per shift, and in restaurants, shifts sometimes ended at 02:00.


Do you know, why this code doesn't work, e.g. InputMask is still empty?
*---------------------- Location Section ------------------------
*   Library: 	Acustomcontrols.vcx
*   Class: 		Txtdate  
*   Method: 	Init() 
*----------------------- Usage Section --------------------------
*)  Description: 
*)

*   Scope:      Public
*   Parameters: 
*$  Usage:      
*$              
*   Returns:  
*--------------------- Maintenance Section ----------------------
*   Change Log:
*       CREATED 	01/31/2005 - NN 
*		MODIFIED
*----------------------------------------------------------------
IF NOT DODEFAULT()
	RETURN .f.
ENDIF
IF TYPE('this.ControlSource') = "C" AND TYPE(this.ControlSource) = "T"
   this.Format = "" && we can not use D format, because it doesn't allow to edit time portion
   LOCAL lcInputMask
   lcInputMask = CHRTRAN(TRANSFORM(DATETIME()),"1234567890","9999999999")
   this.InputMask = STRTRAN(STRTRAN(m.lcInputMask,"M","A"),"P","A")
   =MESSAGEBOX(this.InputMask)
ENDIF
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform