Connect Attribute Methods

The following methods create a connection between a dialog control and an attribute of the dialog object. The attribute is used to reflect the value associated with the dialog control. For instance the text of an edit control.

In a UserDialog the Connect... attribute methods are called automatically from the Add... methods. The proper place for Connect... attribute methods is the InitDialog method.

ConnectEntryLine

>>-aBaseDialog~ConnectEntryLine(--id--+------------------+--)--><
                                      +-,--attributeName-+


The ConnectEntryLine method creates a new attribute and connects it to the entry line id. The attribute has to be synchronized with the entry line manually. This can be done globally with the SetData and GetData methods (see page GetData), or for only one item with the SetEntryLine and GetEntryLine methods (see page GetEntryLine). It is done automatically by Execute when the dialog starts and after it terminates. If AutoDetection is enabled, or if the dialog is created dynamically (manually or based on a resource script), you do not have to use this method or any other Connect... methods that deal with dialog controls).

Arguments:

The arguments are:

id

The ID of the entry field you want to connect.

attributeName

An unused valid Rexx symbol because an attribute with exactly this name is added to the dialog object with this method. Blank spaces, ampersands (&), and colons (:) are removed from the attributeName. If this argument is omitted, is not valid, or already exists, and the ID is numeric, an attribute with the name DATAid is used, where id is the value of the first argument.

Return value:

-1

The specified symbolic ID could not be resolved.

0

No error.

Example:

In the following example, the entry line with ID 202 is associated with the attribute Name. "Put your name here!" is assigned to the newly created attribute. Then the dialog is executed. After the dialog has terminated, the data of the entry line, which the user might have changed, is copied back to the attribute Name.

MyDialog~ConnectEntryLine(202, "Name")
MyDialog~Name="Put your name here!"
MyDialog~Execute("SHOWTOP")
say MyDialog~Name

ConnectComboBox

>>-aBaseDialog~ConnectComboBox(--id--+-------------------------------------+-->
                                     +-,--+---------------+--+-----------+-+
                                          +-attributeName-+  +-,--"LIST"-+

>--)-----------------------------------------------------------><


The ConnectComboBox method creates an attribute and connects it to a combo box. The value of the combo box, that is, the text in the entry line or the selected list item, is associated with this attribute. See ConnectEntryLine for a more detailed description.

If the combo box is of type "Drop down list", you must specify "LIST" to connect an attribute with the combo box.

Return value:

-1

The specified symbolic ID could not be resolved.

0

No error.

ConnectCheckBox

>>-aBaseDialog~ConnectCheckBox(--id--+------------------+--)---><
                                     +-,--attributeName-+


The ConnectCheckBox method connects a check box control to a newly created attribute. A check box attribute has only two valid values: 1 if the box has a check mark, and 0 if it has not. See ConnectEntryLine for a more detailed description.

Return value:

-1

The specified symbolic ID could not be resolved.

0

No error.

ConnectRadioButton

>>-aBaseDialog~ConnectRadioButton(--id--+------------------+---->
                                        +-,--attributeName-+

>--)-----------------------------------------------------------><


The ConnectRadioButton method connects a radio button control to a newly created attribute. A radio button attribute has only two valid values: 1 if the radio button is marked and 0 if it is not. See ConnectEntryLine for a more detailed description.

Return value:

-1

The specified symbolic ID could not be resolved.

0

No error.

ConnectListBox

>>-aBaseDialog~ConnectListBox(--id--+------------------+--)----><
                                    +-,--attributeName-+


The ConnectListBox method connects a list box to a newly created attribute. The value of the attribute is the number of the selected line. Therefore, if the attribute value is 3, the third line is currently selected or will be selected, depending on whether you set data to the dialog or receive it. See ConnectEntryLine for a more detailed description.

Return value:

-1

The specified symbolic ID could not be resolved.

0

No error.

ConnectMultiListBox

>>-aBaseDialog~ConnectMultiListBox(--id--+------------------+--->
                                         +-,--attributeName-+

>--)-----------------------------------------------------------><


The ConnectMultiListBox method connects a list box to a newly created attribute. The list box has the multiple-selection style enabled (by setting the MULTI option when adding this list box), that is, you can select more than one item at the same time. The value of the attribute is a string containing the numbers of the selected lines. The numbers are separated by blank spaces. Therefore, if the attribute value is 3 5 6, the third, fifth, and sixth item are currently selected, or will be selected if SetData is executed. See ConnectEntryLine for a more detailed description.

Return value:

-1

The specified symbolic ID could not be resolved.

0

No error.

Example:

The following example defines a list box with the name of the four seasons. It then preselects the items Summer and Winter. After execution of the dialog, it parses the value of the attribute.

MyDialog = .ResDialog~new(...)
MyDialog~NoAutoDetection
MyDialog~AddListBox(205, ..., "MULTI")
MyDialog~ConnectMultiListBox(205, "ListBox")
seasons.1="Spring"
seasons.2="Summer"
seasons.3="Autumn"
seasons.4="Winter"
do season over seasons
  MyDialog~AddListEntry(205, season)
end
MyDialog~ListBox="2 4"
MyDialog~Execute("SHOWTOP")
selItems = MyDialog~ListBox
do until anItem =""
   parse var selItems anItem selItems
   say "You selected: "seasons.anItem
end

AddAttribute

>>-aBaseDialog~AddAttribute(--id--+------------------+--)------><
                                  +-,--attributeName-+


The AddAttribute method adds an attribute to the dialog object. The attribute is associated with the dialog control id.

Protected:

This method is for internal use only.

Arguments:

The arguments are:

id

The ID of the dialog control.

attributeName

The name you want to give to the attribute. This name must comply with the conventions of Object Rexx for valid symbols. AddAttribute checks whether the argument is valid. In case of an invalid argument, an attribute with the name DATAid is created, where id is the value of the first argument. This method automatically removes blanks, ampersands (&), and colons (:).

Example:

The first and second lines generate the attributes Add and List all items. The third line generates the assembled attribute DATA34 because ListALLitems already exists. The fourth line creates attribute DATA35 because Update+Refresh is not a valid symbol name.

self~AddAttribute(32, "&Add")
self~AddAttribute(33, "List all items")
self~AddAttribute(34, "ListALLitems:")
self~AddAttribute(35, "Update+Refresh")