Listbox events and functions


Event function

event = func_id

The name of the function to be called when an event occurs for the listbox.

The function is called as follows:

func_id(event_code, listbox_id)

The events which cause the function to be called are:

EV_CREATE

The listbox has just been created.

EV_DESTROY

The listbox has just been destroyed.

EV_GAIN_FOCUS

The listbox has gained focus.

EV_LOSE_FOCUS

The listbox has lost focus.

EV_UNSELALL

All selected lines in the listbox have been deselected. This is particularly useful with listboxes that can have multiple selections (edit mode EM_MULTIPLE). When a single line is selected, EV_UNSELALL is sent, informing the program that all previously selected lines have been unselected. EV_SELECT is then sent for the newly selected line.

The user has clicked down or released the right mouse button on the listbox.

If EV_RIGHT_MOUSE_UP is not trapped, releasing the right mouse button over a LIST_EDIT type listbox causes the Windows default menu to appear, with options to Undo, Cut, Copy, Paste, Delete and Select All.

EV_MOUSE_OVER 1

The user has moved the mouse over the listbox during a dialog.

EV_KEYSTROKE 1

A keystroke is typed while the listbox has focus.

EV_CHANGE 1

LIST_EDIT type only. The event is sent after each character typed into a list edit control.

One use of this event is a list that scrolls automatically as the user types, so that the list displays selectable values that match the text typed so far. This method is often used with Windows help systems, where the user is invited to type a keyword. To retrieve the value typed in to a list edit control, call the listbox_get_selected() function, either in the EV_LOSE_FOCUS event or in each EV_CHANGE event, as preferred.

EV_SINGLE_CLICK

The user has selected a row, by highlighting it via the cursor keys or other edit keys, or by means of a single click.

EV_DOUBLE_CLICK

The user has executed a double mouse click on the listbox (LIST_BOX type only), or pressed the RETURN key within a listbox

The events EV_SINGLE_CLICK and EV_DOUBLE_CLICK do not indicate the selected line(s). The built-in functions listbox_get_selected() and is_selected() are used to retrieve the selected lines and their values.

A double click generates both the EV_SINGLE_CLICK and the EV_DOUBLE_CLICK events, in that order.

1(1,2,3,4,5)

These events are not generated by default; they must always be specifically requested for the listbox by means of the event_enable = clause, e.g.

event_enable = EV_DEFAULT | EV_CHANGE

New events may be added in the future.

See Event functions.


Help function

help = func_id

The listbox help function. The function is called as follows:

func_id(EV_HELP, listbox_id)

See Help functions.


Event enable function

event_enable = flags

This clause is used to select the event codes which are to be enabled for the listbox.

Default: The standard set of events listed under the event = clause above.

EXAMPLE

event_enable = EV_DEFAULT | EV_CHANGE

See The event_enable clause.


RELATED TOPICS

Listboxes

Event functions