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 |