Date GETs with century

Date GETs with century

Postby Brian Hays » Tue Dec 13, 2005 10:36 pm

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.
-BH
Brian Hays
 
Posts: 20
Joined: Fri Oct 14, 2005 7:56 am

Postby DanielPuente » Wed Dec 14, 2005 2:01 am

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,
Daniel Puente
Mar del Plata, Argentina
danielpuente@speedy.com.ar
puenteda@hotmail.com
DanielPuente
 
Posts: 108
Joined: Sun Oct 09, 2005 6:12 pm
Location: Mar del Plata - Argentina

Postby Brian Hays » Wed Dec 14, 2005 5:03 am

Daniel:
Thanks! Are you using this code for real? It would appear to work for an SDI app, but with lots of modeless windows it might have problems. Even though one GET has focus and SET CENTURY is true, other windows can paint in the background, and would be affected, yes?
-BH
Brian Hays
 
Posts: 20
Joined: Fri Oct 14, 2005 7:56 am

Re: Date GETs with century

Postby StefanHaupt » Wed Dec 14, 2005 11:10 am

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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby Brian Hays » Wed Dec 14, 2005 9:17 pm

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 :-)
-BH
Brian Hays
 
Posts: 20
Joined: Fri Oct 14, 2005 7:56 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 66 guests