Event Syntax


! Name  

! Name_*

! Name_Event



Character. Name is the name of the event that is placed into a_dlg_button when the Change event occurs.


Character. Name_Event is placed into a_dlg_button when any type of  ControlEvent occurs.


Character. Name_Event is placed into a_dlg_button when it occurs.


The event syntax gives the programmer the opportunity to write Xbasic code in the %code% section of the Xdialog that analyzes the value of a_dlg_button and responds accordingly. Refer to Trapping the Change Event for more information about Xdialog events.


  •  Change

    Character. The value of the control has changed.

  •  Changing

    Character. The value of the control is changing.

  •  Dblclick

    Character. The user double-clicks on the control.

  •  Setfocus

    Character. The control receives focus.

  •  Killfocus

    Character. The control loses focus.


Note how the value of a_dlg_button is reset to NULL after being handled.

dim events[100] as C
dim a_colors[10] as C
colors = "Red,Green,Blue,Yellow,Orange,Pink"
colors = stritran(colors,",",crlf())
item_selected = "Shirt"
ui_dlg_box("Pick a Color",<<%dlg%
Item: [.18item_selected^={Shirt,Tie,Pants,Jacket}!item_changed];
Double click on a color. |Event Name;
[.25,10color_selected^#a_colors!color_*] |[.25,10^#events];
<15Close!close> |<15Clear Events!clear>
events[events.first_empty()] = a_dlg_button
if a_dlg_button = "Clear"
    a_dlg_button = ""
else if a_dlg_button = "Close" then
    'do nothing - the dialog will close
    a_dlg_button = ""
end if

 Responding to Selected Events

To generate other events add "_*" to the event parameter of the control. To respond to a selected event (e.g. killfocus), trap the base event name (e.g. ul_cell ), then test for the extended event name (e.g. ul_cell_killfocus ).

Upper left cell |[.10ul_cell!ul_cell_*];
if left(a_dlg_button,7) = "ul_cell" then
    if a_dlg_button = "ul_cell_killfocus" then
        ul_cell = upper(ul_cell)
        frow = regex_merge(ul_cell, "[A-Z]","")
        fcol = asc(regex_merge(ul_cell, "[0-9]",""))-64
    end if
    a_dlg_button = ""
end if

See Also