DialogControlSet

Changes the text or appearance of a control.

Syntax:

DialogControlSet( dialog-handle, control-name, set-request-code, set-info )

Parameters:

(i) dialog-handle:  handle to dialog

(s) control-name:  name of control to modify

(i) set-request-code:   control property to set

(s/i) set-info:  information to set

Returns:

(i)   1 if successful otherwise 0

 

Use the DialogControlSet function to change the text or appearance of a control.

dialog-handle

The first parameter must be the dialog-handle passed as the first parameter to your dialog procedure.

control-name

Name of the control you wish to modify (for legacy dialog formats, i.e. earlier than 6.2, use the control's number in this parameter.)

set-request-code

The third parameter is a request code. The request code depends on the type of the control you are changing.

set-info

Place new text or state information in the fourth parameter. The type of information you place in the fourth parameter is dependent on the request code you use in the third parameter. The following table shows the possible request codes, the control they apply to and the type information that you need to supply in parameter four.

 

Request

Applicable Controls

Set-info

@dcCheck  (1)

CHECKBOX

REPORTVIEW

CHECKBOX: (i) 1 means check the box, 0 means unchecked the box

REPORTVIEW: (s) Checks or unchecks an item in a REPORTVIEW control. Use the function's set-info (fourth) parameter to indicate the first column text of the row to check or uncheck.  The text can be a delimited list to indicate which row should be checked or unchecked when multiple rows have the same first column text.

 

@dcDot  (2)

RADIOBUTTON

(i) 1 means select button, 0 means clear the selection

 

@dcText   (3)

EDITBOX

MULTILINEBOX

(s) Text replaces the existing text

 

 

@dcTitle  (4)

PICTURE

RADIOBUTTON

CHECKBOX

PICTUREBUTTON

VARYTEXT

STATICTEXT

GROUPBOX

PUSHBUTTON

MENUITEM

 

(s) Text replaces the existing title

 

 

 

 

 

 

 

 

@dcContents (5)

ITEMBOX

FILELISTBOX

DROPLISTBOX

REPORTVIEW

ITEMBOX and DROPLISTBOX: (s) Tab delimited list of items to replace the existing list displayed by the control.

FILELISTBOX: (s) File mask to change or modify the default of "*.*".

REPORTVIEW: (a/s) Replaces the contents of the REPORTVIEW control.  The function's fourth parameter must contain either a CSV file path+name, a one or two dimension array, or a WIL map that will be used to replace the existing contents of the control. Supports variant safe arrays. Note that the @csFirstHeader style is ignored when a WIL map is used as the contents source.

 

@dcSelect  (6)

ITEMBOX

FILELISTBOX

DROPLISTBOX

REPORTVIEW

 

ITEMBOX, FILELISTBOX and DROPLISTBOX: (s) Tab delimited list one or more item you wish to be highlighted as selected. Use an empty string to cancel an existing selection. (Multiple item selection only applies to ITEMBOXs when multi-select is turned on. See IntControl (33, p1, 0, 0, 0) function documentation for information on multi-select )

REPORTVIEW: (s) Toggles the selection state of a row in a REPORTVIEW control. Use the function's set-info (fourth) parameter to indicate the first column text of the row to select or unselect.  The text can be a delimited list of the same item to indicate which row should be selected when multiple rows have the same first column text. Use an empty string to unselect all selected rows of a control. Note that the control automatically unselects a selected row when a new row is  selected when the control has the singleselect (@csSingleSel) style.

Note: use the one based row number to obtain the single or delimited list text for a given REPORTVIEW row by calling the DialogControlGet function with the @dcItemText (31) request-code.

 

@dcDate  (7)

CALENDAR

 

DATETIME

CALENDAR: (s) Date shown in the control in YYYY:MM:DD:HH:MM:SS format. The control's range can also be set using a vertical bar(|) delimited list of YYYY:MM:DD:HH:MM:SS date and time values.  

DATETIME: (s) Request code to set the date/time shown in the control.  The  date/time must be in the YYYY:MM:DD:HH:MM:SS format. The control's range can also be set using a vertical bar(|) delimited list of YYYY:MM:DD:HH:MM:SS date and time values.  Neither the @dcText nor @dcTitle request code can be used to set the displayed date.

 

@dcSpin (8)

SPINNER

(i) Displayed value of control

 

@dcTabStop  (9)

MULTILINEBOX

 

(s) Tab delimited list of one or more numbers that indicate tab stop distance. If the list contains 1 item, tab stops are set at every n dialog template units, where n is the distance indicated by the single item. If the list contains more than 1 item, tab stops are set at each indicated distance. The list item values must be in dialog template units, which are the same units used to specify the size of the control.

 

@dcScroll  (10)

ITEMBOX

FILELISTBOX

MULTILINEBOX

REPORTVIEW

 

ITEMBOX, FILELISTBOX and MULTILINEBOX: (i) One based index of the list item to be scrolled to the top of the control's viewing area. If n is greater than the number of items in the list or less than 1, the list will be scrolled so that the last items in the list are in the control's viewing area.

REPORTVIEW: (s) Scrolls a REPORTVIEW control row into view. Use the function's set-info (fourth) parameter to indicate the first column text of the row to scroll into view.  

@dcBackColor  (11)

RADIOBUTTON

CHECKBOX

VARYTEXT

STATICTEXT

GROUPBOX

PUSHBUTTON

ITEMBOX

FILELISTBOX

DROPLISTBOX

REPORTVIEW

SPINNER

EDITBOX

MULTILINEBOX

DATETIME

 

(s) Background color. The color is specified by three vertical bar (|) delimited numbers ranging from 0 to 255 or a single hexadecimal number preceded by the letter 'h'. To give the control the system default background color, use an empty string ""or the "DEFAULT "key string for this parameter.

 

@dcBitmap  (12)

PICTURE

PICTUREBUTTON

(s) The file specifications of a bitmap. You can use this request to change the bitmap the control is displaying or you can force the control to display its text instead of a bitmap by setting the parameter to an empty string "" or the "DEFAULT" key string.

 

@dcTextColor  (13)

RADIOBUTTON

CHECKBOX

VARYTEXT

STATICTEXT

GROUPBOX

PUSHBUTTON

ITEMBOX

FILELISTBOX

DROPLISTBOX

REPORTVIEW

SPINNER

EDITBOX

MULTILINEBOX

DATETIME

 

(s) Text color. The color is specified by three vertical bar (|) delimited numbers ranging from 0 to 255 or a single hexadecimal number preceded by the letter 'h'.  To give the control the dialog's default text color, use an empty string ""or the "DEFAULT "key string for this parameter

@dcAddItem (14)

ITEMBOX

FILELISTBOX

DROPLISTBOX

REPORTVIEW

 

ITEMBOX, FILELISTBOX and DROPLISTBOX: (s) Text added as an item to the list displayed by the control. If the items in the control are sorted, the new item will be inserted in sort order.

REPORTVIEW: (a/s) Adds a row to a REPORTVIEW control.  The functions function's set-info (fourth) parameter can be an array or delimited list.  If the delimited list lacks enough items or the array enough columns the remaining columns of the control will be left empty.  If either the list or array has too many items or columns, the extra text will be ignored. If an array parameter contains multiple rows, all array rows will be added to the control. Supports variant safe arrays.

 

 

@dcRemItem (15)

ITEMBOX

FILELISTBOX

DROPLISTBOX

REPORTVIEW

 

ITEMBOX, FILELISTBOX and DROPLISTBOX: (s) Text of item to be removed from the list displayed by the control. The text need not match the list item's case but must otherwise be an exact match.

REPORTVIEW: (s) Removes a row from a REPORTVIEW control. Use the function's set-info (fourth) parameter to indicate the first column text of the row to remove.  The text can be a delimited list to indicate which row to remove when multiple rows have the same first column text.

@dcGroupDot  (16)

 

No operation. Valid for DialogControlGet only.

 

@dcPosition  (17)

ALL CONTROLS
(Except MENUBAR and MENUITEM)

(s) Space delimited list of a control's position and size in dialog units relative to the dialog's client area. The first two numbers are the horizontal and vertical location of the upper-left corner of the control while the third and fourth numbers are the width and height of the control.

 

@dcMenuNames  (18)

 

Valid only for DialogControlGet.

 

@dcWnd(19)

 

Valid only for DialogControlGet.

 

@dcHeaderText (20)

REPORTVIEW

(s) Changes the column headings text of a REPORTVIEW control. Place a tab delimited list of the new column headings, one for each column, in the function's set-info (fourth) parameter.

 

@dcColWidth  (21)

REPORTVIEW

(s) Specify a new width in dialog units or as a percentage of the controls width for each REPORTVIEW column as a space delimited list in the function's set-info (fourth) parameter. Column widths can be set to -1 to cause a column's width to fit the column contents. -2 can be used to set a column's width to match the column's header text. Setting the farthest right column to -2 causes that column to fill the remaining width of the control. Use double percent signs(%%) immediately after a number to indicate that a number represents a percent of the total control width.

 

@dcAppendCol (22)

REPORTVIEW

(s) Adds a new column to the far right side of a REPORTVIEW control.  Indicate the columns header text in the functions set-info (fourth) parameter.

 

@dcRemoveCol (23)

REPORTVIEW

(i) Remove a column from a REPORTVIEW control.  The function's set-info parameter should contain one based number from left to right of the column to remove.  Note that column 1, the left most column, cannot be removed from the control.

 

@dcFind(24)

 

Valid only for DialogControlGet.

 

@dcCancelEdit (25)

REPORTVIEW

(i) Toggles canceling of a pending or the next edit of a REPORTVIEW control item.  The set-info parameter should be @True to turn on edit canceling and @False to turn off canceling. The function returns the previous edit cancel setting.

 

@dcGetChecked(26)

 

Valid only for DialogControlGet.

 

@dcColFormat (27)

REPORTVIEW

(s) Specify the format for each REPORTVIEW column as a space delimited in the function's set-info parameter. Valid values and meanings:
0 - left justify text
1 - center justify text
2 - right justify text

 

@dcFormat(28)

DATETIME

(s) Sets a DATETIME control's current display format using the special format characters also used in the control's template text attribute.

 

@dcItemColor (29)

REPORTVIEW

(l) Sets the text and background colors of a REPORVIEW control item.  The item and colors are indicated by placing a space delimited- list in the functions's set-info parameter. The 4 items consist of the one-based row number and one-based column number followed by the text color descriptor and background color descriptors.  The two color descriptors consist of 3 vertical bar(|) delimited numbers representing the color's red, green, and blue values each ranging from 0 to 255 or or a single hexadecimal number preceded by the letter 'h'

Three row values have special meaning:

-1 - add colors to the column of each odd-numbered row
-2 - add colors to the column of each even-nummberd row
-3 - add colors to the column of all row

One Column value has special meaning:

-1 - add colors to all columns of the row

 

@dcItemRow (30)

REPORTVIEW

Valid only for DialogControlGet.

 

@dcItemText (31)

REPORTVIEW

Sets the text of a REPORTVIEW control item o sub-item. The row number, column number (sub-item), and replacement text should be place in space delimited list in the function's set-info parameter. For example, the space delimited list

"1 1 WinBatch"

would replace the text in the first column of the first row with the word "WinBatch".

Note: row and column numbers are one based and this request cannot be used to add a new row or column to the control.

 

 

* Note that the above functions apply case insensitive text comparisons when identifying items in a REPORTVIEW control.

Example:

 

#DefineSubRoutine SetExample(Handle,DialogMessage,DialogControlID,DialogEventInfo,DialogChangeInfo)
Switch (DialogMessage)
   Case @deinit
      DialogProcOptions(Handle, @deSpChange, 1) ; Spinner selection changed.
      nSelection = DialogControlGet(Handle,"Spinner_1",@dcspin) ; Get spinner value
      DialogControlSet(Handle,"StaticText_2",@dctitle,Num2Char(nSelection)) ; Set text
      break;
   Case @despchange
      nSelection = DialogControlGet(Handle,"Spinner_1",@dcspin) ; Get spinner value
      DialogControlSet(Handle,"StaticText_2",@dcTitle,Num2Char(nSelection)) ; Set text
      break;
EndSwitch
Return @retdefault
#EndSubRoutine
SpinnerRange = "0|255|1"
SetExampleFormat=`WWWDLGED,6.2`
SetExampleCaption=`Convert Number to ASCII Character`
SetExampleX=155
SetExampleY=060
SetExampleWidth=187
SetExampleHeight=120
SetExampleNumControls=005
SetExampleProcedure=`SetExample`
SetExampleFont=`DEFAULT`
SetExampleTextColor=`DEFAULT`
SetExampleBackground=`DEFAULT,DEFAULT`
SetExampleConfig=0
SetExampleDPI=`96,8,16`
SetExample001=`022,086,137,014,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
SetExample002=`017,025,030,017,SPINNER,"Spinner_1",SpinnerRange,"48",DEFAULT,2,0,"Microsoft Sans Serif|10752|40|34","0|0|0",DEFAULT`
SetExample003=`017,015,049,008,STATICTEXT,"StaticText_1",DEFAULT,"Select a &Number:",DEFAULT,3,0,DEFAULT,DEFAULT,DEFAULT`
SetExample004=`100,028,032,025,STATICTEXT,"StaticText_2",DEFAULT,DEFAULT,DEFAULT,4,0,"Microsoft Sans Serif|18944|40|34","0|0|0",DEFAULT`
SetExample005=`100,015,043,009,STATICTEXT,"StaticText_3",DEFAULT,"ASCII Letter:",DEFAULT,5,0,DEFAULT,DEFAULT,DEFAULT`
ButtonPushed=Dialog("SetExample")
Exit
See Also:

DialogProcOptions, DialogControlState, DialogControlGet