Get and Set Methods

Get methods are used to retrieve the data from all or individual controls of a dialog. Set methods are used to set the values of all or individual controls, without changing the associated Object Rexx attributes.

GetData

>>-aBaseDialog~GetData-----------------------------------------><


The GetData method receives data from the Windows dialog and copies it to the associated object attributes.

Example:

The following example continues the SetData example:

     .
     .
     .
MyDialog~ConnectEntryLine(102, "ENTRYLINE_1")
MyDialog~ConnectCheckBox(201, )
MyDialog~ConnectListbox(203, "LISTBOX_DAYS")
     .
     .
     .
/* process the dialog */
     .
     .
     .
MyDialog~GetData            /* retrieve dialog item value */
say MyDialog~ENTRYLINE_1
say MyDialog~DATA201
say MyDialog~LISTBOX_DAYS

SetData

>>-aBaseDialog~SetData-----------------------------------------><


The SetData method transfers the values of the dialog object attributes, that are connected to dialog items, to the Windows dialog controls. See the section, Connect Attribute Methods for a discussion of connecting object attributes to the underlying dialog controls.

Note that this method transfers the data for every connected attribute. This may not always be desirable. For instance the focused node of a tree-view control may be changed. For finely grained control of which values are transfered the programmer should use the setValue() or setAttribute() methods. Both of these methods transfer the value of a single object attribute that is specified by the programmer.

Example:

Dialog items with ID 102, 201 and 203 are connected to the attributes ENTRYLINE_1, DATA201, and LISTBOX_DAYS. Attribute DATA201 is generated by the ConnectCheckBox method. Then the attributes are initialized with some values. This does not change the dialog window, unless you run the SetData method.

     .
     .
     .
MyDialog~ConnectEntryLine(102, "ENTRYLINE_1")
MyDialog~ConnectCheckBox(201,)
MyDialog~ConnectListbox(203, "LISTBOX_DAYS")
     .
     .
     .
MyDialog~ENTRYLINE_1="Memorial Day"
MyDialog~DATA201=1
MyDialog~LISTBOX_DAYS="Monday"

MyDialog~SetData

ItemTitle

>>-aBaseDialog~ItemTitle(--id--)-------------------------------><


The ItemTitle method returns the title of the given dialog item.

Arguments:

The only argument is:

id

The ID of the dialog item.

SetStaticText

>>-aBaseDialog~SetStaticText(--id--,--aString--)---------------><


The SetStaticText method changes the text of a static text control.

Arguments:

The arguments are:

id

The ID of the static text control for which you want to change the text.

aString

The new text for the static text control.

GetEntryLine

>>-aBaseDialog~GetEntryLine(--id--)----------------------------><


The GetEntryLine method returns the value of the given entry line.

Arguments:

The only argument is:

id

The ID of the entry line.

SetEntryLine

>>-aBaseDialog~SetEntryLine(--id--,--aString--)----------------><


The SetEntryLine method puts the value of a string into an entry line.

Arguments:

The arguments are:

id

The ID of the entry line.

aString

The value to be assigned to the entry line.

Example:

Assume that three methods are connected to push buttons. The SetToDefault method overrides the value in the Windows dialog entry line 234 with the value 256 but does not change its associated attribute. Using SetEntryLine has the same effect as a change to the entry line made by the user. The associated attribute in the Object Rexx object (DATA234) still has the original value. Thus it is possible to undo the changes or confirm them.

::method SetToDefault
   self~SetEntryLine(234, "256")

::method AcceptValues
   self~GetAttrib(DATA234)

::method UndoChanges
   self~SetAttrib(DATA234)

GetListLine

>>-aBaseDialog~GetListLine(--id--)-----------------------------><


The GetListLine method returns the value of the currently selected list item. If you need the index of the item, use the GetCurrentListIndex method. If no item is selected, a null string is returned.

Arguments:

The only argument is:

id

The ID of the list box.

SetListLine

>>-aBaseDialog~SetListLine(--id--,--aString--)-----------------><


The SetListLine method assigns the value of a string to the list box. Thus the item with the value of aString becomes selected. The first item is selected if the string is not found in the list box. This method does not apply to a multiple selection list box (see SetMultiList).

Arguments:

The arguments are:

id

The ID of the list box.

aString

The value of the item to be selected.

Example:

The following example selects item "New York" in list box 232:

MyBaseDialog~SetListLine(232, "New York")

GetMultiList

>>-aBaseDialog~GetMultiList(--id--)----------------------------><


The GetMultiList method can be applied to a multiple-selection list box. It returns a string containing the indexes of up to 1000 selected items. The numbers are separated by blanks.

Arguments:

The only argument is:

id

The ID of the multiple-selection list box.

Example:

The following example shows how to handle a multiple-selection list box. It parses the returned string as long as it contains an index.

selLines = MyDialog~GetMultiList(555)
do until selLines = ""
   parse var selLines aLine selLines
   say aLine
end

SetMultiList

>>-aBaseDialog~SetMultiList(--id--,--data--)-------------------><


The SetMultiList method selects one or more lines in a multiple-selection list box.

Arguments:

The arguments are:

id

The ID of the multiple-selection list box.

data

The indexes (separated by blanks) of the lines to be selected.

Example:

The following example selects the lines 2, 5, and 6 of list box 345:

MyDialog~SetMultiList(345, "2 5 6")

GetComboLine

>>-aBaseDialog~GetComboLine(--id--)----------------------------><


The GetComboLine method returns the value of the currently selected list item of a combo box. If you need the index of the item, use the GetCurrentComboIndex method. If no item is selected, a null string is returned.

Arguments:

The only argument is:

id

The ID of the combo box.

SetComboLine

>>-aBaseDialog~SetComboLine(--id--,--aString--)----------------><


The SetComboLine method assigns a string to the given combo box. Thus the item with the value of aString becomes selected. If aString is not found in the combo box, then the first item is selected.

Arguments:

The arguments are:

id

The ID of the combo box.

aString

The value of the item to be selected.

GetRadioButton

>>-aBaseDialog~GetRadioButton(--id--)--------------------------><


The GetRadioButton method returns 1 if the radio button is selected, 0 if it is not selected.

Arguments:

The only argument is:

id

The ID of the radio button.

SetRadioButton

>>-aBaseDialog~SetRadioButton(--id--,--data--)-----------------><


The SetRadioButton method marks the radio button if the given data value is 1, and removes the mark if the value is 0.

Arguments:

The arguments are:

id

The ID of the radio button.

data

1 to select the button or 0 to deselect it.

GetCheckBox

>>-aBaseDialog~GetCheckBox(--id--)-----------------------------><


The GetCheckBox method returns the value of a check box: 1 if the check box is selected (has a check mark), 0 if it is not selected.

Arguments:

The only argument is:

id

The ID of the check box.

SetCheckBox

>>-aBaseDialog~SetCheckBox(--id--,--data--)--------------------><


The SetCheckBox method puts a check mark in the check box if the given data value is 1 and removes the check mark if the value is 0.

Arguments:

The arguments are:

id

The ID of the check box.

data

The value 1 to check the box or 0 to remove the check mark.

GetValue

>>-aBaseDialog~GetValue(--id--)--------------------------------><


The GetValue method gets the value of a dialog item, regardless of its type. The item must have been connected before.

Arguments:

The only argument is:

id

The ID of the dialog item.

SetValue

>>-aBaseDialog~SetValue(--id--,--dataString--)-----------------><


The SetValue method sets the value of a dialog item. You do not have to know what kind of item it is. The dialog item must have been connected before.

Arguments:

The arguments are:

id

The ID of the dialog item.

dataString

The value that is assigned to the item. It must be a valid value.

Example:

The following example sets dialog item 123 to (string) value "1 2 3". This is meaningful if 123 is an entry field, or if it is a list box that contains the line "1 2 3". However, it is an error to apply this against a check box.

MyDialog~SetValue(123, "1 2 3")

Note: If it is a multiple-selection list box, the SetValue method does not look for an item with "1 2 3" as value but highlights the first, second, and third line.

GetAttrib

>>-aBaseDialog~GetAttrib(--attributeName--)--------------------><


The GetAttrib method assigns the value of a dialog item to the associated Object Rexx attribute. It does not return a value. You do not have to know the ID or the type of the dialog item.

Arguments:

The only argument is:

attributeName

The name of the attribute.

Example:

The following example shows how to get the data value of a dialog item without knowing its ID:

MyDialog~GetAttrib("FirstName")
if MyDialog~FirstName\="" then ...

SetAttrib

>>-aBaseDialog~SetAttrib(--attributeName--)--------------------><


The SetAttrib method copies the value of an attribute to the associated dialog item. You do not have to know the ID or the type of the dialog item.

Arguments:

The only argument is:

attributeName

The name of the attribute.

Example:

The following example copies the value of the attribute DATA101 to the associated dialog item:

MyBaseDialog~SetAttrib("DATA101")

SetDataStem

>>-aBaseDialog~SetDataStem(--dataStem.--)----------------------><


The SetDataStem method sets all Windows dialog items to the values within the given stem; the suffixes of the stem variable are the dialog IDs.

Protected:

This method is protected.

Arguments:

The only argument is:

dataStem.

A stem variable containing initialization data. Remember the trailing period.

Example:

The following example initializes the dialog items with ID 21, 22, and 23:

     .
     .
     .
dlgStem.21="Windows 95"
dlgStem.22="0"
dlgStem.23="1 2 3"
self~SetDataStem(dlgStem.)

GetDataStem

>>-aBaseDialog~GetDataStem(--dataStem.--)----------------------><


The GetDataStem method gets the values of all dialog items and copies them to the given stem.

Protected:

This method is protected.

Arguments:

The only argument is:

dataStem.

The name of a stem variable to which the data is returned. Remember the trailing period.