DialogProcOptions

Controls when the User-Defined-Callback procedure is called by its associated dialog

Syntax:

DialogProcOptions(dialog-handle, event-code, event-option-value)

Parameters:

(i) dialog-handle: handle to dialog

(i) event-option-code: event code for event that produces call to UDC

(i/s) event-option-value: depends on which event-option-code was specified. See the table of event-option-codes for valid event-option-values.

Returns:

(i)  previous setting for event-code

 

Use the DialogProcOptions function to control when your Use-Defined-Callback procedure is called by its associated dialog. You can also use it to control your dialog's behavior, while your procedure is executing. You usually establish callback events during the first call to the procedure i.e., event 0, but this can be done during any call.

dialog-handle

The dialog-handle is the first parameter to your dialog procedure.

event-option-code

The second parameter can be one of the events or options listed in the table below.

This table provides the list of events and options codes that can be used as the second parameter to the DialogProcOptions. The event codes correspond to the number passed as the second parameter to your User-Defined-Callback procedure.

Event-Option-Code Values and Meanings

Event-Option-Code

Meaning

Event-Option-Value

@deInit (0)

Initialization: dialog has been created but not displayed. This event is only generated once per dialog session.

na

@deTimer (1)

Timer: Set a Timer event

(i)
> 0 - milliseconds between callbacks

0 - turn off timer

-1 - return current setting

 

@dePbPush (2)

Pushbutton or Picturebutton Pushed: User has pressed a PUSHBUTTON or PICTUREBUTTON control.

(i)
1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deRbPush (3)

Radiobutton Selected: User has selected a RADIOBUTTON.

(i)
1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deCbCheck (4)

Checkbox Checked/Unchecked: User has checked or unchecked a CHECKBOX control.

(i)
1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deEdText (5)

Changed text in Editbox or Multilinebox: User has changed the text in an EDITBOX or MULTILINEBOX control

(i)
1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deFlSelect (6)

Filelistbox File Selected: User has selected a file in a FILELISTBOX control

(i)
1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deIbSelect (7)

Itembox Item Selected: User has selected one or more items in a ITEMBOX control.

(i)
1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deDlChange (8)

Droplistbox/Combobox Item Change: User has changed the text appearing at the top of a DROPLISTBOX. This event can be triggered by the user picking a new item from the list portion of the control or by the user typing new text into the control.

 

(i)
1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deCaChange (9)

Calendar Date Change: User has selected a new date in a CALENDAR control.

(i)
1- turn on event callback

0 - turn off callback

-1 - return current setting

@deSpChange (10)

Spinner Number Change: User has changed the value of a SPINNER control.

(i)
1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deClose (11)

Close: User has selected the Close command from the system menu. This event only applies to dialog's with system menus enabled by a call to IntControl 49 or DialogProcOption code 1002.

 

(i)
1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deFlDblclick (12)

Filelistbox File Double-Clicked: the user has used the mouse to double-click an item in an FILELISTBOX.

 

(i)
1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deIbDblclick (13)

Itembox Item Double-Clicked: the user has used the mouse to double-click an item in an ITEMBOX.

Note: It is Standard Windows behavior for the Itembox Item Selected event code ( 7 ) to override this Double-click event code  ( 13 ) .

(i)
1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deMiSelect (15)

Menu Item Selection: the user has clicked a menu item using the mouse, has pressed a menu item's access key while its menu is displayed or the user has pressed a menu item's hot-key combination.

Note: The user-defined callback is not called in response to the selection of menu items via mouse or access key when the menu item has an associated dropdown or submenu.  The associated dropdown or submenu is displayed instead.

 

(i)

1- turn on event callback

0 - turn off callback

-1 - return current setting

@deMiInit (16)

Menu Item Initialization: The user has selected a dropdown menu, submenu or context menu. The name of the menu hosting control or menu item is passed to the user-defined callback as the value of its third parameter.

For example: This event be used to dynamically modify the menu itself.

 

(i)

1- turn on event callback

0 - turn off callback

-1 - return current setting

@deResize (17)

Dialog Resize: The user has resized the dialog. When the user-defined-callback is called with this request, the fifth parameter to the user-defined-callback procedure contains a space delimited of items that represent the change in width and height of the dialog that resulted from the resizing activity and the client width and height.

 

{delta_width} {delta_height} {client_width} {client_height}

 

The delta width and height supplied are in dialog units and can be either negative or positive numbers.  The client area is the area of a window used to display controls and its size does not include the dialog window's borders, menu bar, nor title bar.

 

The dialog template must use the <dlg-var>MinWidth and/or <dlg-var>MinHeight variables in order to use this option. The DialogProcOptions function will error, if this request code is used with a dialog template that does not contain at least one of these variables.

 

(i)

1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deRvrSelect (18)

Item Select Row: User has selected row in the REPORTVIEW control. The text of the first column of the selected row is passed to the callback UDF/UDS in the callback's fifth parameter.

 

Note:This event will only trigger if the user clicks on the first column. If you want to select anywhere on the row, you need to use the full row select style.

(i)

1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deRvrDblclick (19)

Double-Clicked Row: User has used the mouse to double-click a row in the REPORTVIEW control. The text of the first column of the double-clicked row is passed to the callback UDF/UDS in the callback's fifth parameter.

(i)

1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deRviCheck (20)

Checked/Unchecked Item: User has checked or unchecked an item in a REPORTVIEW control with the 'checkbox' style.  The text of the checked item is passed to the callback UDF/UDS in the callback's fifth parameter.

(i)

1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deRviText (21)

Item Text: User has changed the text of a first column item in a REPORTVIEW control. The user modified text of the item is passed to the callback UDF/UDS in the callback's fifth parameter. Note that if more than one first column item of a control contains the same value, it is possible for the fifth parameter to contain a tab delimited list of multiple occurrences of the targeted item's text. The number items in the list indicates which instance of the item is the target of the event.

(i)

1- turn on event callback

0 - turn off callback

-1 - return current setting

 

@deRvhClick (22)

Column Click: User has used the mouse to click a column header of a REPORTVIEW control. The one based column number of the clicked column is passed to the callback UDF/UDS in the callback's fifth parameter. The event is fired before the indicated column is sorted so the sort direction can be controlled by setting or changing the sort direction style of the control during the callback. Sorting is effectively cancelled by removing both sorting related styles from the control.

 

(i)

1- turn on event callback

0 - turn off callback

-1 - return current setting

@deDtChange(23)

Date or time change: User has changed the date/time.  This event also fires if the date/time range is changed and the current value of the DATETIME control does not fall within that range.  The new control date/time is passed to user defined callbacks in the callback's fifth parameter.

(i)

1- turn on event callback

0 - turn off callback

-1 - return current setting

@deFocus(24)

Control input focus change: User has use the mouse or keyboard to change the input focus from one control to another. The control-name parameter of the user-defined-callback contains the name of the control receiving the focus. The change-info parameter contains the name of the control losing the input focus or an empty-string when no control lost the focus.

 

(i)

1- turn on event callback

0 - turn off callback

-1 - return current setting

Other events NOT supported by DialogProcOptions:

@deComEvent (14)

COM-Event: This event is not supported by DialogProcOptions. Use DialogObject to monitor for COM events.

 

Other non-events supported by DialogProcOptions:

@dpoDisable (1000)

Dialog Disable: Grey the dialog's title bar and redraw dialog as necessary. Optionally, display the system's "wait cursor".

Note: If you have code that may take a long time to execute in a callback, you may need to temporarily disable the dialog. Don't forget to enable after the process is complete.

(i)
1 - disable dialog

2 - disable and wait cursor

0 - enable dialog

-1 - return current setting

 

@dpoBkground (1001)

Change Background: Change the dialog's background bitmap or color.

(s)
bitmap file name or RBG color string

(i)
-1 - return current background

 

@dpoSysMenu (1002)

Change System Menu: Change the dialog’s title bar system menu. Note: this dialog option overrides the system menu settings established with IntControl 49.

(i)
0 - no menus

1 - close

2 - close and minimize

3- close and maximize

4 - close, minimize and maximize

-1 - return current setting

 

@dpoTitle (1003)

 

Change Dialog Title: Change the dialog’s title. Note: the maximum dialog title length is 254 characters.

(i)
-1 – return current title

(s)
new dialog title

 

@dpoCtlName (1004)

Get Control Name: Returns the name of the control associated with the number.

(i)
control number

(s)
control name

 

@dpoCtlNumber (1005)

Get Control Number: Returns the control number associated with the name.

(s)
control name

(i)
control number

@dpoClientSize (1007)

 

 

Get Client Area: Return internally maintained width and height of the dialog's client area in dialog-units as a space delimited list. The returned client area dimensions are the dialog's size not including the width and height of  borders, the height of the menu bar, nor the height of the title bar. The third parameter to DialogProcOptions must be set to -1 when using this request code.

 

(i)

-1 – return client area

 

 

Note: Although you can set the second parameter to zero (0), it will have no effect, because event 0 only happens once.

For events codes, turn on the event by setting the third parameter to one (1). Turning on the indicated event causes a call to your dialog procedure each time the event occurs. When your dialog procedure is called because of the event, the event code will appear in the second parameter of the procedure. Turn off an event by setting the third parameter to zero (0) You can programmatically determine the current setting for an event code or option by setting the second parameter to the event or option of interest and setting the third parameter to minus one (-1). The function returns the current setting without changing it.

Notes - Option @dpoDisable:You can change your dialog's behavior during a callback by using this function with the second parameter set to dialog option  @dpoDisable and specifying one (1) or two (2) as the third parameter. This gives the dialog's title bar the appearance of an inactive window. It also allows your dialog to redraw itself if it becomes covered and then uncovered by another window while the callback procedure performs a lengthy task. When you place a two (2) in the third parameter, you get the above-mentioned changes and in addition, the mouse cursor will become the system defined "wait cursor" when the user moves it over the dialog. Dialog option @dpoDisable is best used before your dialog callback performs lengthy processing or when it calls any WIL function that suspends the execution of your dialog procedure. RunWait and TimeDelay are two examples of functions that suspend script execute. Dialog option @dpoDisable takes effect immediately after the DialogProcOptions statement but it is cancelled automatically when the current call to your dialog procedure returns. You can manually cancel option @dpoDisable by making a DialogProcOptions call with the second parameter set to @dpoDisable and the third parameter set to zero (0).

Notes - Option @dpoBkground: Use dialog option @dpoBkground to dynamically change your dialog's background to the bitmap or color placed in the functions third parameter. You can use a three-field color specification, a bitmap file name or the DEFAULT key word to set the background to a specific color, a picture or the system default color for dialogs. You can discover the current dialog background by setting the third parameter to minus one (-1).

event-option-value

The third parameter depends on which event-option-code was specified. See the table of event-option-codes for valid event-option-values.

 

Example:



;Here is an example of using a one second timer event.
#DefineFunction TimerProc(MyDialogHandle,MyDialogMessage,MyDialogControlID,MyDialogEventInfo,MyDialogChangeInfo)
Switch MyDialogMessage
   Case @deInit
      ; enable 1 second timer events
      DialogProcOptions(MyDialogHandle, @deTimer, 1000)
      Return (@retdefault)
   Case @detimer
      Clock=DialogControlGet(MyDialogHandle, "VaryText_1", @dcTitle)
      Clock=Clock-1
      If Clock==0 Then Return(2) ; exit, buttonpushed==2
      DialogControlSet(MyDialogHandle, "VaryText_1", @dcTitle, Clock)
      Return(@retDefault)
EndSwitch ; MyDialogMessage
Return(@retDefault) ; Do default processing
#EndFunction

TimerFormat=`WWWDLGED,6.2` TimerCaption=`Timer Example` TimerX=078 TimerY=129 TimerWidth=121 TimerHeight=117 TimerNumControls=003 TimerProcedure=`TimerProc` TimerFont=`DEFAULT` TimerTextColor=`DEFAULT` TimerBackground=`DEFAULT,DEFAULT` TimerConfig=0 TimerDPI=`96,8,16` Timer001=`012,082,035,014,PUSHBUTTON,"PushButton_1",DEFAULT,"OK",1,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT` Timer002=`066,082,035,014,PUSHBUTTON,"PushButton_2",DEFAULT,"Cancel",0,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT` Timer003=`023,015,070,053,VARYTEXT,"VaryText_1",clock,"10",DEFAULT,DEFAULT,@csCenter,"Tahoma|49152|70|34","128|0|0",DEFAULT` ButtonPushed=Dialog("Timer")

 
See Also:

DialogControlState, DialogControlGet, DialogControlSet