Do an action on CANCEL
Posted: Sat Mar 11, 2017 8:18 pm
How do you do an action when CANCEL was pressed.
Code: Select all
STATIC FUNCTION XSample_3
/*
@ SAY..GETS (PIXEL BASED)
This sample demonstrates several @ DCSAY..GETs with automatic sizing
of the dialog window to the objects and an additional set of buttons
for OK and CANCEL. The window is MODAL. Coordinates are PIXEL-based.
*/
LOCAL GetList := {}, dDate := Date(), nNumber := 12345.67, ;
cString := 'This is a string', lLogical := .t., GetOptions
SET DATE FORMAT TO 'mm/dd/yyyy'
@ 10,1 DCSAY 'Enter a Date' GET dDate PICTURE '99/99/9999' ;
SAYRIGHT GETSIZE 100
@ 30,1 DCSAY 'Enter a Number' GET nNumber SAYRIGHT
@ 50,1 DCSAY 'Enter a String' GET cString SAYRIGHT
@ 70,1 DCSAY 'Enter Yes or No' GET lLogical PICTURE 'Y' SAYRIGHT
DCGETOPTIONS ;
WINDOWHEIGHT 300 ;
WINDOWWIDTH 400 ;
SAYWIDTH 120 ;
PIXEL ;
TITLE 'Data Entry' // Store options to GetOptions
DCREAD GUI ;
TITLE 'Pixel-Based GETs' ;
BUTTONS DCGUI_BUTTON_OK + DCGUI_BUTTON_CANCEL ;
MODAL ;
OPTIONS GetOptions
// evaluate here if cancel was pressed
// if cancel is pressed, say "Hello Cancel is pressed" in a dialog.
RETURN nil
*** END OF EXAMPLE ***