FUNCTION TESTALT
// Indicates differences between results when clicking a button
// compared to instead using ALT accelerator for the button.
// Example 1. BUTTON'S ACTION DOESN'T FURTHER CHANGE THE FOCUS:
// If ALT accelerator is pressed for a button when the current focus
// is on a GET which has a valid, focus returns to the control (in
// this case a GET) that had focus before the button's action was
// executed - and the valid is executed twice.
// If instead the button is clicked, focus remains on the BUTTON after
// the button's action is executed - and the valid hass executed just
// once.
//
// 2. BUTTON'S ACTION DOES FURTHER CHANGE THE FOCUS:
// If ALT accelerator is pressed for a button when the current focus
// is on a GET which has a valid, focus returns to the control (in
// this case a GET) that had focus before the button's action was
// executed - and the valid is not executed until AFTER the button's
// ACTION.
// If instead the button is clicked, focus remains on the BUTTON after
// the button's action is executed - and the valid is executed BEFORE
// the button's ACTION.
//--------------------------------------------
#include 'Fivewin.ch'
LOCAL oDlg
LOCAL oGet1, oGet2, oGet3, oBtn
LOCAL cVar1 := 'ABCDEF '
LOCAL cVar2 := SPACE(8)
LOCAL cVar3 := SPACE(8)
DEFINE DIALOG oDlg FROM 0, 0 TO 10, 30 ;
TITLE 'Test Alt / Button / GET_VALID'
@ 1, 1 GET oGet1 VAR cVar1 SIZE 30,12 PIXEL ;
Valid (MSGBEEP(), .T. )
@ 2, 1 GET oGet2 VAR cVar2 SIZE 30,12
@ 3, 1 GET oGet3 VAR cVar3 SIZE 30,12
// Example 1: ACTION doesn't try to further change focus:
@ 40,50 BUTTON oBtn PROMPT '&Test' ;
SIZE 30, 20 PIXEL ;
ACTION (SYSWAIT(1), ( cVar2 := cVar1 ), oGet2:Refresh())
// Example 2: Next ACTION does try to further change focus.
// Uncomment to see the difference:
/*
@ 40,50 BUTTON oBtn PROMPT '&Test' ;
SIZE 30, 20 PIXEL ;
ACTION MsgInfo('This is a test')
*/
ACTIVATE DIALOG oDlg CENTER
return NIL
//-------------------------------------------------
Hope you can help fix if a bug, or tell me what I need to do.
Thanks,
Colin Wisbey