Consultor Eletrônico



Kbase 15513: How to change the default button in GUI at runtime
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
How to change the default button in GUI at runtime

DRAFT COPY - Currently under review and edit.

INTRODUCTION:
=============
The default button is the button who will be executed by pressing
RETRUN if the widget that currently has focus doesn`t process the
RETURN key and is not a button. The default button doesn`t need focus
to be executed.

WHY YOU NEED TO KNOW THIS:
===========================
Default button is a attribute which can be activated in the properties
of a button. There can be only ONE active default button in a FRAME.
If you make another button to the default button the previous default
button becomes a normal button by loosing the default button attribute
automatically. If you want to have different default buttons in your
program, you have to change the default button attribute at runtime.

PROCEDURAL APPROACH:
====================
Every button who potentially may become the default button needs the
default attribute. The default attribute must be set BEFORE the widget
is enabled:
V8: create local-initialize and put the assign default before
RUN dispatch IN THIS-PROCEDURE ( INPUT 'initialize':U ).
V7: put the assign default in the Main-Block before RUN enable_UI.
Otherwise you will get:
**Unable to set attribute DEFAULT-BUTTON for <widget id>. (4078)
when you try to assign the new default-button widget handle.
For example:
ASSIGN Btn_OK:DEFAULT IN FRAME {&FRAME-NAME} = TRUE
Btn_Cancel:DEFAULT IN FRAME {&FRAME-NAME} = TRUE.
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:
FRAME {&FRAME-NAME}:DEFAULT-BUTTON = Btn_OK:HANDLE.

Note: It is not possible to change the default button in an character
environment!

REFERENCES TO WRITTEN DOCUMENTATION:
====================================
See Programming Handbook: Default Buttons

Progress Software Technical Support Note # 15513