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.
>>-aBaseDialog~GetData-----------------------------------------><
The GetData method receives data from the Windows dialog and copies it to the associated object attributes.
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
>>-aBaseDialog~SetData-----------------------------------------><
The SetData method transfers data from the Object Rexx attributes to the Windows dialog.
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
>>-aBaseDialog~ItemTitle(--id--)-------------------------------><
The ItemTitle method returns the title of the given dialog item.
The only argument is:
The ID of the dialog item.
>>-aBaseDialog~SetStaticText(--id--,--aString--)---------------><
The SetStaticText method changes the text of a static text control.
The arguments are:
The ID of the static text control for which you want to change the text.
The new text for the static text control.
>>-aBaseDialog~GetEntryLine(--id--)----------------------------><
The GetEntryLine method returns the value of the given entry line.
The only argument is:
The ID of the entry line.
>>-aBaseDialog~SetEntryLine(--id--,--aString--)----------------><
The SetEntryLine method puts the value of a string into an entry line.
The arguments are:
The ID of the entry line.
The value to be assigned to the entry line.
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)
>>-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.
The only argument is:
The ID of the list box.
>>-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).
The arguments are:
The ID of the list box.
The value of the item to be selected.
The following example selects item "New York" in list box 232:
MyBaseDialog~SetListLine(232, "New York")
>>-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.
The only argument is:
The ID of the multiple-selection list box.
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
>>-aBaseDialog~SetMultiList(--id--,--data--)-------------------><
The SetMultiList method selects one or more lines in a multiple-selection list box.
The arguments are:
The ID of the multiple-selection list box.
The indexes (separated by blanks) of the lines to be selected.
The following example selects the lines 2, 5, and 6 of list box 345:
MyDialog~SetMultiList(345, "2 5 6")
>>-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.
The only argument is:
The ID of the combo box.
>>-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.
The arguments are:
The ID of the combo box.
The value of the item to be selected.
>>-aBaseDialog~GetRadioButton(--id--)--------------------------><
The GetRadioButton method returns 1 if the radio button is selected, 0 if it is not selected.
The only argument is:
The ID of the radio button.
>>-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.
The arguments are:
The ID of the radio button.
1 to select the button or 0 to deselect it.
>>-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.
The only argument is:
The ID of the check box.
>>-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.
The arguments are:
The ID of the check box.
The value 1 to check the box or 0 to remove the check mark.
>>-aBaseDialog~GetValue(--id--)--------------------------------><
The GetValue method gets the value of a dialog item, regardless of its type. The item must have been connected before.
The only argument is:
The ID of the dialog item.
>>-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.
The arguments are:
The ID of the dialog item.
The value that is assigned to the item. It must be a valid value.
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.
>>-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.
The only argument is:
The name of the attribute.
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 ...
>>-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.
The only argument is:
The name of the attribute.
The following example copies the value of the attribute DATA101 to the associated dialog item:
MyBaseDialog~SetAttrib("DATA101")
>>-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.
This method is protected.
The only argument is:
A stem variable containing initialization data. Remember the trailing period.
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.)
>>-aBaseDialog~GetDataStem(--dataStem.--)----------------------><
The GetDataStem method gets the values of all dialog items and copies them to the given stem.
This method is protected.
The only argument is:
The name of a stem variable to which the data is returned. Remember the trailing period.