Progress
Language Tutorial
for Character


Viewing and Hiding Widgets

There’s some important default Progress behavior that determines when widgets are visible and when they are not. This section outlines Progress’s default behavior so you know when to rely on it. This section also introduces the VIEW and HIDE statements, which allow you to control the display of widgets.

Default Viewing and Hiding

When you use DISPLAY and ENABLE statements, Progress takes care of making the appropriate widgets visible. When you DISPLAY any widget, all the widgets in the widget’s frame become visible. When you ENABLE a widget, all the widgets in the frame become visible, although Progress only enables the widget you specified. Progress’s default viewing and hiding behavior concentrates on displaying and hiding frames of widgets, not individual widgets.

Viewing and Hiding Widgets

You can explicitly view and hide frames or view and hide widgets within frames by using the VIEW and HIDE statements. This is a partial syntax for the VIEW statement.

SYNTAX
VIEW widget-list 

This is a partial syntax for the HIDE statement.

SYNTAX
HIDE [ widget-list | MESSAGE | ALL ] [ NO-PAUSE ] 

The following table describes the new language elements:

Element
Description
MESSAGE
You can also use the HIDE statement to hide the contents of the default message area.
NO-PAUSE
Use the NO-PAUSE option to prevent Progress from pausing before hiding data.

To hide or view a frame, substitute the keyword FRAME and frame name for widget-list:

VIEW FRAME Frame1.
HIDE FRAME Frame2. 

To hide or view one or more widgets in a frame, specify a list of widgets and, if necessary, append the IN FRAME frame-name syntax to individual widget references:

VIEW Widget1 IN FRAME Frame1 Widget2 IN FRAME Frame2.
HIDE Widget1 IN FRAME Frame1 Widget2 IN FRAME Frame2. 

Up to now you used the frame phrase, which begins with WITH, to specify a frame. Here you use the IN FRAME syntax. The difference is that WITH is used to create or modify a frame and its attributes, while IN FRAME merely references an existing frame.

One very important thing to remember about using VIEW and HIDE is that they do not affect the enabled status of a widget. If a widget is enabled when you hide it, it will still be enabled when you view it again. Enabling and viewing are separate functions.

Follow these steps to demonstrate both uses of HIDE and VIEW.

  1. Open lt-03-09.p.
  2. Choose Compile Run. The visible interface consists of buttons and a small frame with its border showing and a widget within the frame. All the HIDE and VIEW statements will operate on this small frame and the widget within it:
  3. Choose Hide Frame. The small frame disappears.
  4. Choose View Frame. The frame reappears.
  5. Choose Hide Widget. The widget inside the small frame disappears.
  6. Choose View Widget. The widget inside reappears.
  7. Choose Hide Widget again.
  8. Choose Hide Frame and then View Frame. Notice that the widget inside the small frame is not visible. When you explicitly hide a widget within a frame, viewing and hiding the containing frame does not affect the hidden widget.
  9. Choose View Widget. Now the hidden widget is visible.
  10. Choose Exit to end the procedure.
  11. Press SPACEBAR to return to the Procedure Editor.

Here is the code that created the display:

lt-03-09.p
    /**********  DEFINE FIELD-LEVEL WIDGETS  **********/
    DEFINE BUTTON btn-View-F LABEL "View Frame".
    DEFINE BUTTON btn-Hide-F LABEL "Hide Frame".
    DEFINE BUTTON btn-View-W LABEL "View Widget".
    DEFINE BUTTON btn-Hide-W LABEL "Hide Widget".
    DEFINE BUTTON btn-Widget LABEL "Widget".
    DEFINE BUTTON btn-Exit LABEL "Exit".

    /**********  DEFINE FRAMES  **********/
    DEFINE FRAME Frame1
      SKIP(1) btn-View-F btn-Hide-F SKIP(1)
      btn-View-W btn-Hide-W SKIP(1) 
      btn-Exit SKIP(1)
         WITH NO-BOX CENTERED THREE-D.
    DEFINE FRAME Frame2
      SKIP(1) btn-Widget SKIP(1)
/*1*/    WITH TITLE "Frame" CENTERED THREE-D.

    /**********  DEFINE TRIGGERS  **********/
    ON CHOOSE OF btn-View-F
    DO:
/*2*/    VIEW FRAME Frame2.
    END. /* ON CHOOSE OF btn-View-F */
    ON CHOOSE OF btn-Hide-F
    DO:
/*3*/    HIDE FRAME Frame2.
    END. /* ON CHOOSE OF btn-Hide-F */
    ON CHOOSE OF btn-View-W 
    DO:
/*4*/    VIEW btn-Widget IN FRAME Frame2.
    END. /* ON CHOOSE OF btn-View-W */
    ON CHOOSE OF btn-Hide-W
    DO:
/*5*/    HIDE btn-Widget IN FRAME Frame2.
    END. /* ON CHOOSE OF btn-Hide-W */

    /**********  MAIN LOGIC  **********/
    ENABLE btn-View-F btn-Hide-F btn-View-W btn-Hide-W btn-Exit 
        WITH FRAME Frame1.
    ENABLE btn-Widget WITH FRAME Frame2.
    WAIT-FOR CHOOSE OF btn-Exit. 

These notes help explain the code:

  1. When you display the default border of a frame, you can use the TITLE option to give the whole frame a label.
  2. The first trigger views the frame. You must include the keyword FRAME or Progress will attempt to find a field-level widget with the specified name.
  3. As with VIEW, the HIDE statement only requires a valid frame reference.
  4. Here, you are viewing a widget within a frame. You need to specify the widget and the frame reference with IN FRAME.
  5. Hiding a specific widget also requires both widget and frame references.

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