DialogControlState

Changes a control’s style or give control input focus.

Syntax:

DialogControlState(dialog-handle, control-name, request-code, style)

Parameters:

(i) dialog-handle: handle to dialog

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

(i) request-code: see below

(i) style: style to change

Returns:

(i/s)  0 failure, 1 success, or a controls style.

 

Use this function to get a control's style, change a control’s style, assign a control the input focus, or retrieve the name of the control with the focus.

 

When you are using request code five (5) the function will return an empty string ("") or zero (0) for legacy dialogs, if no control in your dialog has the input focus at the time of the function call. In most cases, it is not necessary to use this request code to determine which control has the input focus form within your Use-Defined-Callback procedure. This is because most callbacks occur only when a control has the input focus and because the number of the control that caused the callback and, therefore, has the focus, is passed as a parameter to your procedure. The DialogProcOptions event-codes 0, 1, 11, 1000, 1001, 1002 and 1003 are the exceptions because these events are not associated with any dialog controls.

 

dialog-handle

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

 

control-name

The name of the control you wish to modify. Unless you are using request code five (5). In which case this parameter gets ignored.

 

request-code
Set the request-code to one (1), if you want to give a control the input focus. Set it to two (2) to have the function return a control's style. Use three (3) to add one or more styles to a control and four (4) to remove styles. Use five (5) to retrieve the name (or number for legacy dialogs) of the control with the input focus. To position the mouse cursor in the center of the control indicated by control-name set it to six (6).

Note: When you are using request code five (5) the function will return zero (0), if no control in your dialog has the input focus at the time of the function call. In most cases, it is not necessary to use this request code to determine which control has the input focus form within your Use-Defined-Callback procedure. This is because most callbacks occur only when a control has the input focus and because the number of the control that caused the callback and, therefore, has the focus, is passed as a parameter to your procedure. The DialogProcOption event-codes 0, 1, 11, 1000, 1001, 1002 and 1003 are the exceptions because these events are not associated with any dialog controls.

request-code

meaning

@dcsSetFocus (1)

Give a control the input focus

@dcsGetStyle (2)

Query a control's style

@dcsAddStyle (3)

Add one or more styles to a control

@dcsRemStyle (4)

Remove styles from a control

@dcsGetFocus (5)

Get control that has focus

@dcsMouseOver (6)

Position mouse cursor over control

 

style

This parameter is ignored when you are giving a control the input focus (1), fetching a controls style (2), the name of the control with the input focus (5), or positioning the mouse cursor (6). Otherwise, it should contain the styles you wish to add or remove. The style values are the same as those used in the control style attribute of the dialog template. More than one style can be added or removed in a single function call by using the bit wise OR (|) operator to construct a bitmask of targeted styles.

Note: The exceptions are the 'List Only style' (4) of a DROPLISTBOX and the 'No Auto-resize' (256) of ITEMBOX and FILELISTBOX controls. These styles can only be set in the dialog template.

 

Style

Meaning

Controls

@csInvisible (1)

Control is invisible

 

All

@csDisabled (2)

Control has disabled appearance and does not accept any user input, if would otherwise accept input.

PUSHBUTTON

RADIOBUTTON

CHECKBOX

PICTUREBUTTON

EDITBOX

MULTILINEBOX

ITEMBOX

FILELISTBOX

CALENDAR

DROPLISTBOX

REPORTVIEW

SPINNER

GROUPBOX

VARYTEXT

STATICTEXT

DATETIME

MENUITEM

@csListOnly (4)

Note: Not supported in this function.

This style can only be set in the dialog template. Control will only accept values already in the drop down list portion of the control

DROPLISTBOX

@csReadOnly (8)

The controls text cannot be changed by typing in new text when the control has the input focus. (Note: The user can still change the value in a SPINNER controls by using the up and down arrows.

 

EDITBOX

MULTILINEBOX

SPINNER

@csPassword (16)

Displays all characters as an asterisk (*) as they are typed into the control.

EDITBOX

@csDefButton (32)

A button with this style is the default button when no push or picture button has the input focus. The user can select this button by pressing the enter key if no button has the input focus. You should only give one button this style. If you give the style to more than one button, only the first button (in the tab order) will have the style. Generally, give this style to the button that is the most likely option in your dialog.

 

PUSHBUTTON

PICTUREBUTTON

 

@csDigits (64)

Allows only digits to be entered into the edit type controls. Note: even with this set, it is still possible to paste non-digits into the edit control.

 

EDITBOX

MULTILINEBOX

@csFlat (128)

Creates a button with a flat appearance. All aspects of the button's border are removed including the 3d shadowing.

 

PUSHBUTTON

PICTUREBUTTON

 

@csNoAdjust (256)

Note: Not supported in this function. This style can only be set in the dialog template.

 

ITEMBOX

FILELISTBOX

@csCenter (512)

 

Centers text horizontally in the control’s rectangle. (Cannot be used with style 1024)

 

Note: Not supported in this function for EDITBOX and MULTILINEBOX controls. This style can only be set in the dialog template.

VARYTEXT

STATICTEXT

EDITBOX

MULTILINEBOX

@csRight (1024)

Displays text flush-right in the control’s rectangle.  (Cannot be used with style 512)

 

VARYTEXT

STATICTEXT

EDITBOX

MULTILINEBOX

@csCurLeft (2048)

Prevents text selection when control gets the input focus. Cursor is placed to the left of any existing text in the control.

 

EDITBOX

MULTILINEBOX

@csCurRight (4096)

Prevents text selection when control gets the input focus. Cursor is placed to the right of any existing text in the control.

EDITBOX

MULTILINEBOX

@csShield (8192)

Display Security Shield icon on button (Vista/2008 or newer)

PUSHBUTTON

PICTUREBUTTON

@csMenuCheck (32768)

Adds a check mark to the left of a menu item

MENUITEM

@csMenuRadio (65536)

Adds a radio button like dot graphic to the left of a menu item

MENUITEM

@csMenuSep (131072)

Causes a separator bar graphic to display instead of text at the menu item's location in the menu

MENUITEM

@csMenuBreak (262144)

Cause a column break to occur at the specific item when used with drop-down, context, or submenus.  Causes a line break (new row) with menu items hosted directly by the MENUBAR

MENUITEM

@csNoHeader (524288)

The header bar is not display across the top of the control.

REPORTVIEW

@csFirstHeader (1048576)

The first row of the source array or file is treated as column header text.  Note that this style is ignored when a WIL map is used as the contents source.

REPORTVIEW

@csGrid (2097152)

The control displays vertical and horizontal lines to form a grid.

REPORTVIEW

@csSingleSel (4194304)

Only one row can be selected at a time.

REPORTVIEW

@csFullSel (8388608)

Selection highlighting extends to all sub items in the selected row.

REPORTVIEW

@csAsort (16777216)

(sortascending) The control is populated with rows ordered from lowest to highest first column values. Sorts using a "WIL relational operator" sort (See ArraySort for details). The user can reorder control rows based on any column's values by clicking on the column header.

REPORTVIEW

@csDsort (33554432)

(sortdescending) The control is populated with rows ordered from highest to lowest first column values. Sorts using an "WIL relational operator"  sort (See ArraySort for details).  The user can reorder control rows based on any column's values by clicking on the column header.

REPORTVIEW

@csColEdit (67108864)

The first column text can be edited in place.

REPORTVIEW

@csColCheck (134217728)

Enables check boxes for each first column item in the control.

REPORTVIEW

@csIncHeader (268435456)

Causes the column header text to be included when the control's contents are save to file or array.

REPORTVIEW

@csCheckbox (134217728)

Adds a check box that indicates no date/time value when unchecked.

DATETIME

@csSpinner (536870912)

Replaces the controls drop down calendar with a spinner.  The spinner can be used to change the value of individual elements of the displayed date/time.

DATETIME

@csLogSort (1073741824)

(logical sort) The control is populated with rows ordered from lowest to highest first column values. Sorts using a case-insensitive logical sort (See ArraySort for details).  The user can reorder control rows based on any column's values by clicking on the column header. The logical sort order can be change to a high to low sort by using the @csDsort style  with the @csLogSort style.

REPORTVIEW

 

Example:


#DefineSubRoutine Flash(Handle,DialogMessage,DialogControlID,DialogEventInfo,DialogChangeInfo)
Switch (DialogMessage)
   Case @deInit ; Initialization
      DialogProcOptions(Handle, 1, 250) ; Set a 1 quarter second timer.
      break;
   Case @deTimer ; Timer
      nStyle = DialogControlState(Handle,"StaticText_1",@dcsGetStyle,0)
      If nStyle & @csInvisible
         DialogControlState(Handle,"StaticText_1",@dcsRemStyle,@csInvisible) ; Clear the invisible bit
      Else
         DialogControlState(Handle,"StaticText_1",@dcsAddStyle,@csInvisible) ; Set the invisible bit
      EndIf
      break;
EndSwitch
Return @retDefault
#EndSubRoutine
FlasherFormat=`WWWDLGED,6.2`
FlasherCaption=`Flasher`
FlasherX=329
FlasherY=060
FlasherWidth=178
FlasherHeight=078
FlasherNumControls=002
FlasherProcedure=`Flash`
FlasherFont=`DEFAULT`
FlasherTextColor=`DEFAULT`
FlasherBackground=`DEFAULT,DEFAULT`
FlasherConfig=0
FlasherDPI=`96,8,16`
Flasher001=`069,053,034,014,PUSHBUTTON,"PushButton_Stop",DEFAULT,"Stop!",1,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Flasher002=`064,013,044,030,STATICTEXT,"StaticText_1",DEFAULT,DEFAULT,DEFAULT,2,0,DEFAULT,DEFAULT,"255|0|0"`
ButtonPushed=Dialog("Flasher",1)
See Also:

DialogProcOptions, DialogControlGet, DialogControlSet, User Defined Subroutine