Progress
AppBuilder
Developer’s Guide


Adding a Widget to a Palette Button Pop-up Menu

You create and define custom widgets in a custom object file. Here is the syntax for adding custom widgets:

SYNTAX
*widget-type name
[ DESCRIPTION [ description-text-string ] ]
{ [ attribute value ] ...
  [ INHERIT name-of-entry ] ...
  [ trigger-block ] ...
} ...
RUN file-name 

*widget-type

Specifies the type of custom widget to create. It must be one of the following: BROWSE, BUTTON, COMBO-BOX, EDITOR, FILL-IN, FRAME, IMAGE, RADIO-SET, RECTANGLE, SELECTION-LIST, TEXT, and TOGGLE-BOX.

name

Specifies the display name of the custom widget as it appears on the Palette submenu (or pop-up menu on the Palette). After you choose a widget, AppBuilder displays display-name, followed by widget-type, in the status bar of AppBuilder main window.

DESCRIPTION [ description-text-string ]

Specifies the description of the widget. The description helps another developer to read and understand the intent of each custom widget.

attribute

Specifies an attribute to set for the widget. You can specify any attribute that you can also set from the widget’s property sheet. See Table C–2, later in this appendix, for a list of the attributes that you can specify and the widgets to which they can apply.

value

Specifies the value for attribute (based on the data type of the attribute).

INHERIT name-of-entry

Specifies the display name of another widget in the custom widgets file. The current widget inherits all of the attribute settings specified for the other widget. If attribute settings conflict, the latter setting applies.

trigger-block

Specifies a trigger for the custom widget:

SYNTAX
TRIGGER event
  DO [ trigger-code ] END.
END TRIGGER 

In this syntax, event specifies an event to pair with the custom widget and trigger-code specifies the code statements to execute for the widget/event pair.

RUN file-name

Specifies a procedure to run immediately before the object is created. The procedure file can take two parameters:

Table C–2 describes the attributes you can set in the custom objects file and the widgets to which they apply. In the Data Type column:

Sample Widget Entry

The following sample entry is in the src/template/progress.cst file:

*BUTTON         Ne&xt 
DESCRIPTION     Simple Navigation Button
INHERIT         C&ustom Size/Color
LABEL           &Next
NAME            Btn_Next
TRIGGER CHOOSE
DO:
  &IF "{&PROCEDURE-TYPE}" EQ "SmartPanel" &THEN
    &IF "{&ADM-VERSION}" EQ "ADM1.1" &THEN
      RUN notify IN THIS-PROCEDURE ("get-next") NO-ERROR.
    &ELSE
      PUBLISH "fetchNext":U.
    &ENDIF
  &ELSEIF "{&TABLES-IN-QUERY-{&FRAME-NAME}}" NE "" &THEN
/*
**  This is a simple NEXT RECORD navigation button, useful for building
**  test screens quickly.  NOTE: if there are no tables in the query,
**  then this code will not compile’ so use the preprocessor to skip it.
*/
    GET NEXT {&FRAME-NAME}.
    IF NOT AVAILABLE {&FIRST-TABLE-IN-QUERY-{&FRAME-NAME}}
      THEN GET LAST {&FRAME-NAME}.
    IF AVAILABLE {&FIRST-TABLE-IN-QUERY-{&FRAME-NAME}} THEN DO:
      DISPLAY {&FIELDS-IN-QUERY-{&FRAME-NAME}} WITH FRAME {&FRAME-NAME}.
      {&OPEN-BROWSERS-IN-QUERY-{&FRAME-NAME}}
    END.
  &ENDIF
END TRIGGER 

If you analyze this sample entry one section at a time, you can see how to write your own custom widget entry. In this example:


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