ADD Action

#### Search Results

Search

# ADD Action

This document covers the following topics:

- Description

- Parameters for the ADD WITH option

## Description

Creates a single specified dialog element dynamically. See also Creating/Deleting Dialog Elements Dynamically in the section Event-Driven Programming Techniques documentation. This action is most frequently used to add items to a List Box Control or to a Selection Box Control or to add column specifications to a table. It can also be used to create all kinds of dialog elements dynamically.

There are two syntax options of this action:

#### PROCESS GUI ACTION ADD WITH...

This option has the parameters as listed below. Other attributes of the newly created dialog element have to be set in the global attributes list before the PROCESS GUI statement.

#### PROCESS GUI ACTION ADD WITH PARAMETERS... END-PARAMETERS

This option accepts a list of attribute assignments, one for each attribute that is to be specified for the newly created dialog element. If you use this option, the global attribute list is not used or affected. For all attributes that are not explicitly specified, the default value is taken.

## Parameters for the ADD WITH option

Name/Data Type | Explanation
--- | ---
HANDLE OF GUI | Input The handle of the parent dialog element.
Type (I4) | Input The type of dialog element to be created.
HANDLE OF GUI | Output The handle of the newly created dialog element.
Response (I4) | Output Natural error (if applicable).

#### Example 1 (option 1):

     DEFINE DATA LOCAL
       1 #NEW1 HANDLE OF INPUTFIELD
       END-DEFINE
       ...
       #NEW1.STRING:= 'NEW1'
       #NEW1.RECTANGLE-X:= 24
       #NEW1.RECTANGLE-Y:= 30
       #NEW1.RECTANGLE-W:= 176
       #NEW1.RECTANGLE-H:= 28
       #NEW1.ENABLED:= TRUE
       #NEW1.VISIBLE:= TRUE
       PROCESS GUI ACTION ADD WITH #DLG$WINDOW INPUTFIELD #NEW1

#### Example 2 (option 2):

    DEFINE DATA LOCAL
       1 #NEW2 HANDLE OF INPUTFIELD
       END-DEFINE
       ...
       PROCESS GUI ACTION ADD WITH PARAMETERS
          HANDLE-VARIABLE = #NEW2
          TYPE = INPUTFIELD
          STRING = 'NEW2'
          RECTANGLE-X = 24
          RECTANGLE-Y = 30
          RECTANGLE-W = 176
          RECTANGLE-H = 28
          ENABLED = TRUE
          VISIBLE = TRUE
          PARENT = #DLG$WINDOW
       END-PARAMETERS

If you insert a new dialog element dynamically by using the ADD action, you determine its position in the navigation sequence by creating the dialog element and setting the SUCCESSOR attribute to the handle value of its successor.

#### Example:

       /* Insert Input Field Control #NEW1 before push button control #PB-1
       /* Be careful not to trigger the PROCESS GUI statement action from a push
       /* button control named #PB-1 because you are already defining it
       DEFINE DATA LOCAL
       1 #NEW1 HANDLE OF INPUTFIELD
       1 #PB-1 HANDLE OF PUSHBUTTON
       END-DEFINE
       ...
       PROCESS GUI ACTION ADD WITH PARAMETERS
          PARENT = #DLG$WINDOW
          HANDLE-VARIABLE = #NEW1
          TYPE = INPUTFIELD
          SUCCESSOR = #PB-1
          ...
       END-PARAMETERS

### On this page

- Description
- Parameters for the ADD WITH option