Has anyone worked it out to have a 4-digit year on a specific date GET independent of SET CENTURY ?
I have particular fields (Birthdays) that should always display full year, but other fields should just be 2-digit years. Using FWH.
Date GETs with century
-
- Posts: 108
- Joined: Sun Oct 09, 2005 6:12 pm
- Location: Mar del Plata - Argentina
- Contact:
Brian:
You can manage the date as a character variable por the specific get, or you can:
SET CENTURY OFF
REDEFINE GET oFecha VAR vFecha ID 102 FONT oFont2 of oDlg COLOR CLR_BLACK,RGB(255,255,168)
REDEFINE GET oFecha2 VAR vFecha2 ID 34 FONT oFont2 of oDlg COLOR CLR_BLACK,RGB(255,255,168)
oFecha2:bGotFocus:={|| centuryon(oFecha2) }
oFecha2:bLostFocus:={|| centuryoff() }
ACTIVATE DIALOG oDlg CENTERED ON INIT FECHASINIT(oFecha2)
STATIC FUNCTION FECHASINIT(oFecha2)
SET CENTURY ON
oFecha2:Refresh()
SET CENTURY OFF
RETURN NIL
STATIC FUNCTION CENTURYON(oFecha2)
SET CENTURY ON
oFecha2:Refresh()
RETURN NIL
STATIC FUNCTION CENTURYOFF()
SET CENTURY OFF
RETURN NIL
Regards,
You can manage the date as a character variable por the specific get, or you can:
SET CENTURY OFF
REDEFINE GET oFecha VAR vFecha ID 102 FONT oFont2 of oDlg COLOR CLR_BLACK,RGB(255,255,168)
REDEFINE GET oFecha2 VAR vFecha2 ID 34 FONT oFont2 of oDlg COLOR CLR_BLACK,RGB(255,255,168)
oFecha2:bGotFocus:={|| centuryon(oFecha2) }
oFecha2:bLostFocus:={|| centuryoff() }
ACTIVATE DIALOG oDlg CENTERED ON INIT FECHASINIT(oFecha2)
STATIC FUNCTION FECHASINIT(oFecha2)
SET CENTURY ON
oFecha2:Refresh()
SET CENTURY OFF
RETURN NIL
STATIC FUNCTION CENTURYON(oFecha2)
SET CENTURY ON
oFecha2:Refresh()
RETURN NIL
STATIC FUNCTION CENTURYOFF()
SET CENTURY OFF
RETURN NIL
Regards,
-
- Posts: 20
- Joined: Fri Oct 14, 2005 7:56 am
-
- Posts: 824
- Joined: Thu Oct 13, 2005 7:39 am
- Location: Germany
Re: Date GETs with century
Brian,
I think the simpliest way is to convert the date into a character, put it in the get-field and convert it back later. So you can use any format you want in the get.
Stefan
I think the simpliest way is to convert the date into a character, put it in the get-field and convert it back later. So you can use any format you want in the get.
Stefan
-
- Posts: 20
- Joined: Fri Oct 14, 2005 7:56 am
Stefan:
Thanks. Actually I talked this thru with Luis Krause Mantilla and we hacked TClipGet to give us a new feature. I'll be proposing an xHarbour extension to the PICTUREs supported by transform() and GETs to allow @2 to force 2-digit years and @4 to force four digit years at a low level.
But for now our changes to TClipGet work great! All I have to do is give a date GET a picture of "@4" and it always shows the century independently of the global setting
Thanks. Actually I talked this thru with Luis Krause Mantilla and we hacked TClipGet to give us a new feature. I'll be proposing an xHarbour extension to the PICTUREs supported by transform() and GETs to allow @2 to force 2-digit years and @4 to force four digit years at a low level.
But for now our changes to TClipGet work great! All I have to do is give a date GET a picture of "@4" and it always shows the century independently of the global setting
-BH