Consultor Eletrônico



Kbase 16827: Applying Focus to a SmartObject in a SmartDialog
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
Applying Focus to a SmartObject in a SmartDialog

INTRODUCTION
============
This knowledgebase entry discusses how to workaround the problem
of not being able to apply focus to a SmartObject that is
contained on a SmartDialog.

WHY YOU NEED TO KNOW THIS
=========================
Normally, in 8.1A, you would be able to apply focus to a
SmartObject in a SmartContainer by running dispatch
"apply-entry" in that object, refer to knowledgebase entry
entry 16749: How to Apply Focus to a SmartWindow Run With
Select-Page for more information about this.

There is an existing problem with SmartDialogs where this
will not work. You may workaround this problem in 8.0A and
8.1A by making the SmartObject that you want to have focus
be the first object in the SmartDialog's tab order.

PROCEDURAL APPROACH
===================
Consider an example where you have a SmartDialog that contains
a SmartBrowser and an OK button. When you run this SmartDialog
the button has initial focus instead of the SmartBrowser. You
can force focus to go to the SmartBrower by putting it first
in the tab order with the following in a local-initialze
procedure of the SmartDialog:

DEF VAR v-handle AS WIDGET-HANDLE.
DEF VAR b-handle AS WIDGET-HANDLE.
DEF VAR statok AS LOGICAL.

RUN dispatch IN THIS-PROCEDURE (INPUT 'initialize':U).

RUN get-attribute IN h_b-cust (INPUT 'adm-object-handle').
ASSIGN v-handle = WIDGET-HANDLE(return-value).

ASSIGN b-handle = Btn_OK:HANDLE IN FRAME {&FRAME-NAME}.

statok = v-handle:MOVE-BEFORE-TAB-ITEM(b-handle).

END PROCEDURE.

This code will make the SmartBrowser the first object in the
SmartDialog's tab order which will give the SmartBrowser
focus instead of the button when the SmartDialog is run.
For more information about changing SmartObject tab order
refer to knowledgebase entry 16665, Tab Order and Smart Objects.

REFERENCES TO WRITTEN DOCUMENTATION
===================================
Progress Language Reference: Widgets, Attributes & Methods,
Events & Indexes
Progress Programming Handbook


Progress Software Technical Support Note # 16827