PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → WD17 - Default keys to enter todays date in Date Picker
WD17 - Default keys to enter todays date in Date Picker
Débuté par Yogi Yang, 30 sep. 2014 06:22 - 4 réponses
Posté le 30 septembre 2014 - 06:22
Are there any default keys that a user can use to either:
- Clear the contents of Date Picker (make it null)
-OR-
- Enter Today's Date

TIA

Yogi Yang
Posté le 30 septembre 2014 - 11:20
Hi Yogi,

you could put a button on your screen with your desired shortcut.
In the click event of your button, you could assign today() to your DatePicker field

Regards,
Bart
Posté le 01 octobre 2014 - 13:01
Thanks Bart, for this tip.

Actually I am already using it. But I have observed in other dev tools that there are a few short keys that allow one to do these and was expecting something like that in WD Data Picker control. <img src="/NG2013_WEB/ui/smiley/1.gif" align=absmiddle border=0 alt=":)">
Posté le 01 octobre 2014 - 13:28
Hello Yogi,

This will go in the fields Key Down
dDatevalue is Date = MySelf
gp_DateShortCuts(dDatevalue,MySelf..Name,CurrentWin)


This is a procedure for a date field for date short cuts.

PROCEDURE gp_DateShortCuts(gdDate is Date,sDateField is string,sWindowName is string = "",bHasModRecFlag is boolean=True) bModifiedFag is boolean = False //If the date field is empty we use the current date IF {sDateField,indControl} > 19000101 THEN gdDate = {sDateField,indControl} ELSE gdDate = Today() END nKeyT is int = 0x54 // T Key // Checks whether t Key was pressed IF KeyPressed(nKeyT) THEN // Insert the current date {sDateField,indControl} = Today() gdDate = {sDateField,indControl} bModifiedFag = True END nKeyPlus is int = 0xbb // Checks whether + or = Key was pressed IF KeyPressed(nKeyPlus) THEN // Adds one day to the date gdDate..Day += 1 {sDateField,indControl} = gdDate bModifiedFag = True END nKeyMinus is int = 0xbd // Checks whether - Key was pressed IF KeyPressed(nKeyMinus) THEN // Subtracts one day from the date gdDate..Day -= 1 {sDateField,indControl} = gdDate bModifiedFag = True END nDays is int = 0 nKeyA is int = 0x41 // A Key // Checks whether A or a Key was pressed IF KeyPressed(nKeyA) THEN //A popup window open and asks the user for a number to add the date nDays= OpenPopupPosition(WIN_Form_AddToDate,poBottom,"Add To Date") gdDate..Day += nDays {sDateField,indControl} = gdDate bModifiedFag = True END nKeyS is int = 0x53 // S Key // Checks whether s or S Key was pressed IF KeyPressed(nKeyS) THEN //A popup window open and asks the user for a number to subtract from the date nDays= OpenPopupPosition(WIN_Form_AddToDate,poBottom,"Subtract From Date") gdDate..Day -= nDays {sDateField,indControl} = gdDate bModifiedFag = True END //If the window has a Modified flag set it(Not all windows need this) IF bHasModRecFlag THEN IF bModifiedFag THEN IF sWindowName > "" THEN {sWindowName+".GP_ModifiedRecord",indControl}..Modified = True {sWindowName+".BTN_Save",indControl}..State = Active END END END //Setes the Modified property of the date field IF bModifiedFag THEN {sDateField,indControl}..Modified=True END
DW
Posté le 01 octobre 2014 - 14:55
DW,

Thanks for the code. I will surely use it.

Yogi Yang