Progress
Language Reference


FOCUS System Handle

Interfaces
OS
SpeedScript
All
All
No

A handle to the field-level widget that is the current field.

SYNTAX

FOCUS [ :attribute ] 

attribute

An attribute of the widget that has current input focus. The specific attributes available depend on the type of the widget. You can determine the widget type by examining the FOCUS:TYPE attribute.

EXAMPLE

The following example uses the FOCUS handle to provide helpful information to the user. The procedure displays an interface that contains several different types of widgets. If you type ?, the procedure displays a message specifying the type of widget that has focus and whether VALUE-CHANGED event is a valid event for that widget.

r-focus.p
DEFINE VARIABLE inv-price LIKE item.price.
DEFINE VARIABLE inv-value LIKE item.price.
DEFINE VARIABLE report-type AS INTEGER INITIAL 1.

DEFINE BUTTON ok-butt LABEL "OK" AUTO-GO.
DEFINE BUTTON cancel-butt LABEL "CANCEL" AUTO-ENDKEY.
      
FORM
   inv-price LABEL "Price"
      AT ROW 1.25 COLUMN 2
   report-type LABEL "Report Sorted ..."
      AT ROW 2.25 COLUMN 2 
      VIEW-AS RADIO-SET RADIO-BUTTONS "By Catalog Page",   1,
                                      "By Inventory Value", 2
   SKIP
   ok-butt cancel-butt
   WITH FRAME select-frame SIDE-LABELS.

ON ? ANYWHERE
  DO:
     MESSAGE "This is a" FOCUS:TYPE + ". VALUE-CHANGED is"
         (IF VALID-EVENT(FOCUS, "VALUE-CHANGED") THEN "a" ELSE "NOT a")
         "valid event for this widget."
         VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
     RETURN NO-APPLY.  
END.

ENABLE ALL WITH FRAME select-frame.

WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW. 

Note that this example prevents you from entering the question mark character (?) in any field. This does not cause a problem in r-focus.p because a question mark is not a valid input character for any field in the interface.

NOTES

SEE ALSO

SELF System Handle, WAIT-FOR Statement


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095