Kbase P87169: How to change the default button in GUI at runtime?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  17/10/2004 |
|
Status: Unverified
GOAL:
How to change the default button in GUI at runtime?
GOAL:
What is the default button?
GOAL:
Can I have more than one default button on a frame?
FACT(s) (Environment):
Windows
FIX:
The default button is the button that will be executed by pressing the RETURN key if the widget that currently has focus does not have a trigger for the RETURN event and is not a button. The default button does not need focus to be executed.
Default button is an attribute which can be activated in the properties of a button. There can be only ONE active default button in a FRAME. If another button is made to the default button the previous default button becomes a normal button by loosing the default button attribute automatically. In order to have different default buttons in a program, the default button attribute has to be changed at runtime.
Potentially, every button that may become the default button needs the default attribute. The default attribute must be set BEFORE the widget is enabled:
For example:
ASSIGN Btn_OK:DEFAULT IN FRAME {&FRAME-NAME} = TRUE
Btn_Cancel:DEFAULT IN FRAME {&FRAME-NAME} = TRUE.
ENABLE ALL WITH FRAME {&FRAME-NAME}.
The above ASSIGN statement makes Btn_OK and Btn_Cancel candidates for the default button, but because they are in the same frame only one of them can be the default button.
To set the default button the frame needs the handle of the widget. e.g.:
FRAME {&FRAME-NAME}:DEFAULT-BUTTON = Btn_OK:HANDLE.