wxEvtHandler

The Event handler.

The Event handler.

To get events from wxwidgets objects you subscribe to them by calling connect/[2-3]. Events are sent as messages, if no callback was supplied These messages will be #wx{} where EventRecord is a record that depends on the event type. The records are defined in: wx/include/wx.hrl.

If a callback was supplied to connect, the callback will be invoked (in another process) to handle the event. The callback should be of arity 2. fun(EventRecord::wx(), EventObject::wxObject()).

Beware that the callback will be in executed in new process each time.

The orginal documentation.

DATA TYPES

wx() = #wx{id=integer(), obj=wxObject() (see module wx), userData=term(), event=Rec}

Rec is a event record.

wxAuiManager() = #wxAuiManager{type=wxEventType(), manager=wxAuiManager() (see module wxAuiManager), pane=wxAuiPaneInfo() (see module wxAuiPaneInfo), button=integer(), veto_flag=bool(), canveto_flag=bool(), dc=wxDC() (see module wxDC)}
EventType:

aui_pane_button, aui_pane_close, aui_pane_maximize, aui_pane_restore, aui_render, aui_find_manager

Callback event: wxAuiManagerEvent

wxAuiNotebook() = #wxAuiNotebook{type=wxEventType(), old_selection=integer(), selection=integer(), drag_source=wxAuiNotebook() (see module wxAuiNotebook)}
EventType:

command_auinotebook_page_close, command_auinotebook_page_changed, command_auinotebook_page_changing, command_auinotebook_button, command_auinotebook_begin_drag, command_auinotebook_end_drag, command_auinotebook_drag_motion, command_auinotebook_allow_dnd, command_auinotebook_tab_middle_down, command_auinotebook_tab_middle_up, command_auinotebook_tab_right_down, command_auinotebook_tab_right_up, command_auinotebook_page_closed, command_auinotebook_drag_done, command_auinotebook_bg_dclick

Callback event: wxAuiNotebookEvent

wxCalendar() = #wxCalendar{type=wxEventType()}
EventType:

calendar_sel_changed, calendar_day_changed, calendar_month_changed, calendar_year_changed, calendar_doubleclicked, calendar_weekday_clicked

Callback event: wxCalendarEvent

wxChildFocus() = #wxChildFocus{type=wxEventType()}
EventType:

child_focus

Callback event: wxChildFocusEvent

wxClose() = #wxClose{type=wxEventType()}
EventType:

close_window, end_session, query_end_session

Callback event: wxCloseEvent

wxColourPicker() = #wxColourPicker{type=wxEventType(), colour=colour() (see module wx)}
EventType:

command_colourpicker_changed

Callback event: wxColourPickerEvent

wxCommand() = #wxCommand{type=wxEventType(), cmdString=string(), commandInt=integer(), extraLong=integer()}
EventType:

command_button_clicked, command_checkbox_clicked, command_choice_selected, command_listbox_selected, command_listbox_doubleclicked, command_text_updated, command_text_enter, command_menu_selected, command_slider_updated, command_radiobox_selected, command_radiobutton_selected, command_scrollbar_updated, command_vlbox_selected, command_combobox_selected, command_tool_rclicked, command_tool_enter, command_checklistbox_toggled, command_togglebutton_clicked, command_left_click, command_left_dclick, command_right_click, command_set_focus, command_kill_focus, command_enter

Callback event: wxCommandEvent

wxContextMenu() = #wxContextMenu{type=wxEventType()}
EventType:

context_menu

Callback event: wxContextMenuEvent

wxDate() = #wxDate{type=wxEventType(), date=datetime() (see module wx)}
EventType:

date_changed

Callback event: wxDateEvent

wxDisplayChanged() = #wxDisplayChanged{type=wxEventType()}
EventType:

display_changed

Callback event: wxDisplayChangedEvent

wxErase() = #wxErase{type=wxEventType(), dc=wxDC() (see module wxDC)}
EventType:

erase_background

Callback event: wxEraseEvent

wxEventType() = aui_find_manager | aui_pane_button | aui_pane_close | aui_pane_maximize | aui_pane_restore | aui_render | calendar_day_changed | calendar_doubleclicked | calendar_month_changed | calendar_sel_changed | calendar_weekday_clicked | calendar_year_changed | char | char_hook | child_focus | close_window | command_auinotebook_allow_dnd | command_auinotebook_begin_drag | command_auinotebook_bg_dclick | command_auinotebook_button | command_auinotebook_drag_done | command_auinotebook_drag_motion | command_auinotebook_end_drag | command_auinotebook_page_changed | command_auinotebook_page_changing | command_auinotebook_page_close | command_auinotebook_page_closed | command_auinotebook_tab_middle_down | command_auinotebook_tab_middle_up | command_auinotebook_tab_right_down | command_auinotebook_tab_right_up | command_button_clicked | command_checkbox_clicked | command_checklistbox_toggled | command_choice_selected | command_colourpicker_changed | command_combobox_selected | command_dirpicker_changed | command_enter | command_filepicker_changed | command_fontpicker_changed | command_html_link_clicked | command_kill_focus | command_left_click | command_left_dclick | command_list_begin_drag | command_list_begin_label_edit | command_list_begin_rdrag | command_list_cache_hint | command_list_col_begin_drag | command_list_col_click | command_list_col_dragging | command_list_col_end_drag | command_list_col_right_click | command_list_delete_all_items | command_list_delete_item | command_list_end_label_edit | command_list_insert_item | command_list_item_activated | command_list_item_deselected | command_list_item_focused | command_list_item_middle_click | command_list_item_right_click | command_list_item_selected | command_list_key_down | command_listbox_doubleclicked | command_listbox_selected | command_menu_selected | command_notebook_page_changed | command_notebook_page_changing | command_radiobox_selected | command_radiobutton_selected | command_right_click | command_scrollbar_updated | command_set_focus | command_slider_updated | command_spinctrl_updated | command_splitter_doubleclicked | command_splitter_sash_pos_changed | command_splitter_sash_pos_changing | command_splitter_unsplit | command_text_enter | command_text_updated | command_togglebutton_clicked | command_tool_enter | command_tool_rclicked | command_tree_begin_drag | command_tree_begin_label_edit | command_tree_begin_rdrag | command_tree_delete_item | command_tree_end_drag | command_tree_end_label_edit | command_tree_get_info | command_tree_item_activated | command_tree_item_collapsed | command_tree_item_collapsing | command_tree_item_expanded | command_tree_item_expanding | command_tree_item_gettooltip | command_tree_item_menu | command_tree_item_middle_click | command_tree_item_right_click | command_tree_key_down | command_tree_sel_changed | command_tree_sel_changing | command_tree_set_info | command_tree_state_image_click | command_vlbox_selected | context_menu | create | date_changed | destroy | detailed_help | display_changed | end_session | enter_window | erase_background | grid_cell_begin_drag | grid_cell_change | grid_cell_left_click | grid_cell_left_dclick | grid_cell_right_click | grid_cell_right_dclick | grid_col_size | grid_editor_created | grid_editor_hidden | grid_editor_shown | grid_label_left_click | grid_label_left_dclick | grid_label_right_click | grid_label_right_dclick | grid_range_select | grid_row_size | grid_select_cell | help | iconize | idle | joy_button_down | joy_button_up | joy_move | joy_zmove | key_down | key_up | kill_focus | leave_window | left_dclick | left_down | left_up | maximize | menu_close | menu_highlight | menu_open | middle_dclick | middle_down | middle_up | motion | mouse_capture_changed | mousewheel | move | navigation_key | nc_enter_window | nc_leave_window | nc_left_dclick | nc_left_down | nc_left_up | nc_middle_dclick | nc_middle_down | nc_middle_up | nc_motion | nc_paint | nc_right_dclick | nc_right_down | nc_right_up | paint | paint_icon | palette_changed | query_end_session | query_new_palette | right_dclick | right_down | right_up | sash_dragged | scroll_bottom | scroll_changed | scroll_linedown | scroll_lineup | scroll_pagedown | scroll_pageup | scroll_thumbrelease | scroll_thumbtrack | scroll_top | scrollwin_bottom | scrollwin_linedown | scrollwin_lineup | scrollwin_pagedown | scrollwin_pageup | scrollwin_thumbrelease | scrollwin_thumbtrack | scrollwin_top | set_cursor | set_focus | show | size | spin | spin_down | spin_up | stc_autocomp_selection | stc_calltip_click | stc_change | stc_charadded | stc_do_drop | stc_doubleclick | stc_drag_over | stc_dwellend | stc_dwellstart | stc_hotspot_click | stc_hotspot_dclick | stc_key | stc_macrorecord | stc_marginclick | stc_modified | stc_needshown | stc_painted | stc_romodifyattempt | stc_savepointleft | stc_savepointreached | stc_start_drag | stc_styleneeded | stc_updateui | stc_uridropped | stc_userlistselection | stc_zoom | sys_colour_changed | update_ui
wxEvtHandler()

An object reference

wxFileDirPicker() = #wxFileDirPicker{type=wxEventType(), path=string()}
EventType:

command_filepicker_changed, command_dirpicker_changed

Callback event: wxFileDirPickerEvent

wxFocus() = #wxFocus{type=wxEventType()}
EventType:

set_focus, kill_focus

Callback event: wxFocusEvent

wxFontPicker() = #wxFontPicker{type=wxEventType(), font=wxFont() (see module wxFont)}
EventType:

command_fontpicker_changed

Callback event: wxFontPickerEvent

wxGrid() = #wxGrid{type=wxEventType(), row=integer(), col=integer(), x=integer(), y=integer(), selecting=bool(), control=bool(), meta=bool(), shift=bool(), alt=bool()}
EventType:

grid_cell_left_click, grid_cell_right_click, grid_cell_left_dclick, grid_cell_right_dclick, grid_label_left_click, grid_label_right_click, grid_label_left_dclick, grid_label_right_dclick, grid_row_size, grid_col_size, grid_range_select, grid_cell_change, grid_select_cell, grid_editor_shown, grid_editor_hidden, grid_editor_created, grid_cell_begin_drag

Callback event: wxGridEvent

wxHelp() = #wxHelp{type=wxEventType()}
EventType:

help, detailed_help

Callback event: wxHelpEvent

wxHtmlLink() = #wxHtmlLink{type=wxEventType(), linkInfo=wxHtmlLinkInfo() (see module wx)}
EventType:

command_html_link_clicked

Callback event: wxHtmlLinkEvent

wxIconize() = #wxIconize{type=wxEventType()}
EventType:

iconize

Callback event: wxIconizeEvent

wxIdle() = #wxIdle{type=wxEventType()}
EventType:

idle

Callback event: wxIdleEvent

wxJoystick() = #wxJoystick{type=wxEventType()}
EventType:

joy_button_down, joy_button_up, joy_move, joy_zmove

Callback event: wxJoystickEvent

wxKey() = #wxKey{type=wxEventType(), x=integer(), y=integer(), keyCode=integer(), controlDown=bool(), shiftDown=bool(), altDown=bool(), metaDown=bool(), scanCode=bool(), uniChar=integer(), rawCode=integer(), rawFlags=integer()}
EventType:

char, char_hook, key_down, key_up

Callback event: wxKeyEvent

wxList() = #wxList{type=wxEventType(), code=integer(), oldItemIndex=integer(), itemIndex=integer(), col=integer(), pointDrag={X::integer(), Y::integer()}}
EventType:

command_list_begin_drag, command_list_begin_rdrag, command_list_begin_label_edit, command_list_end_label_edit, command_list_delete_item, command_list_delete_all_items, command_list_key_down, command_list_insert_item, command_list_col_click, command_list_col_right_click, command_list_col_begin_drag, command_list_col_dragging, command_list_col_end_drag, command_list_item_selected, command_list_item_deselected, command_list_item_right_click, command_list_item_middle_click, command_list_item_activated, command_list_item_focused, command_list_cache_hint

Callback event: wxListEvent

wxMaximize() = #wxMaximize{type=wxEventType()}
EventType:

maximize

Callback event: wxMaximizeEvent

wxMenu() = #wxMenu{type=wxEventType()}
EventType:

menu_open, menu_close, menu_highlight

Callback event: wxMenuEvent

wxMouse() = #wxMouse{type=wxEventType(), x=integer(), y=integer(), leftDown=bool(), middleDown=bool(), rightDown=bool(), controlDown=bool(), shiftDown=bool(), altDown=bool(), metaDown=bool(), wheelRotation=integer(), wheelDelta=integer(), linesPerAction=integer()}
EventType:

left_down, left_up, middle_down, middle_up, right_down, right_up, motion, enter_window, leave_window, left_dclick, middle_dclick, right_dclick, mousewheel, nc_left_down, nc_left_up, nc_middle_down, nc_middle_up, nc_right_down, nc_right_up, nc_motion, nc_enter_window, nc_leave_window, nc_left_dclick, nc_middle_dclick, nc_right_dclick

Callback event: wxMouseEvent

wxMouseCaptureChanged() = #wxMouseCaptureChanged{type=wxEventType()}
EventType:

mouse_capture_changed

Callback event: wxMouseCaptureChangedEvent

wxMove() = #wxMove{type=wxEventType()}
EventType:

move

Callback event: wxMoveEvent

wxNavigationKey() = #wxNavigationKey{type=wxEventType(), flags=integer(), focus=wxWindow() (see module wxWindow)}
EventType:

navigation_key

Callback event: wxNavigationKeyEvent

wxNcPaint() = #wxNcPaint{type=wxEventType()}
EventType:

nc_paint

Callback event: wxNcPaintEvent

wxNotebook() = #wxNotebook{type=wxEventType()}
EventType:

command_notebook_page_changed, command_notebook_page_changing

Callback event: wxNotebookEvent

wxPaint() = #wxPaint{type=wxEventType()}
EventType:

paint, paint_icon

Callback event: wxPaintEvent

wxPaletteChanged() = #wxPaletteChanged{type=wxEventType()}
EventType:

palette_changed

Callback event: wxPaletteChangedEvent

wxQueryNewPalette() = #wxQueryNewPalette{type=wxEventType()}
EventType:

query_new_palette

Callback event: wxQueryNewPaletteEvent

wxSash() = #wxSash{type=wxEventType(), edge=WxSashEdgePosition, dragRect={X::integer(), Y::integer(), W::integer(), H::integer()}, dragStatus=WxSashDragStatus}
EventType:

sash_dragged

Callback event: wxSashEvent

wxScroll() = #wxScroll{type=wxEventType(), commandInt=integer(), extraLong=integer()}
EventType:

scroll_top, scroll_bottom, scroll_lineup, scroll_linedown, scroll_pageup, scroll_pagedown, scroll_thumbtrack, scroll_thumbrelease, scroll_changed

Callback event: wxScrollEvent

wxScrollWin() = #wxScrollWin{type=wxEventType()}
EventType:

scrollwin_top, scrollwin_bottom, scrollwin_lineup, scrollwin_linedown, scrollwin_pageup, scrollwin_pagedown, scrollwin_thumbtrack, scrollwin_thumbrelease

Callback event: wxScrollWinEvent

wxSetCursor() = #wxSetCursor{type=wxEventType()}
EventType:

set_cursor

Callback event: wxSetCursorEvent

wxShow() = #wxShow{type=wxEventType()}
EventType:

show

Callback event: wxShowEvent

wxSize() = #wxSize{type=wxEventType(), size={W::integer(), H::integer()}, rect={X::integer(), Y::integer(), W::integer(), H::integer()}}
EventType:

size

Callback event: wxSizeEvent

wxSpin() = #wxSpin{type=wxEventType(), commandInt=integer()}
EventType:

command_spinctrl_updated, spin_up, spin_down, spin

Callback event: wxSpinEvent

wxSplitter() = #wxSplitter{type=wxEventType()}
EventType:

command_splitter_sash_pos_changed, command_splitter_sash_pos_changing, command_splitter_doubleclicked, command_splitter_unsplit

Callback event: wxSplitterEvent

wxStyledText() = #wxStyledText{type=wxEventType(), position=integer(), key=integer(), modifiers=integer(), modificationType=integer(), text=string(), length=integer(), linesAdded=integer(), line=integer(), foldLevelNow=integer(), foldLevelPrev=integer(), margin=integer(), message=integer(), wParam=integer(), lParam=integer(), listType=integer(), x=integer(), y=integer(), dragText=string(), dragAllowMove=bool(), dragResult=WxDragResult}
EventType:

stc_change, stc_styleneeded, stc_charadded, stc_savepointreached, stc_savepointleft, stc_romodifyattempt, stc_key, stc_doubleclick, stc_updateui, stc_modified, stc_macrorecord, stc_marginclick, stc_needshown, stc_painted, stc_userlistselection, stc_uridropped, stc_dwellstart, stc_dwellend, stc_start_drag, stc_drag_over, stc_do_drop, stc_zoom, stc_hotspot_click, stc_hotspot_dclick, stc_calltip_click, stc_autocomp_selection

Callback event: wxStyledTextEvent

wxSysColourChanged() = #wxSysColourChanged{type=wxEventType()}
EventType:

sys_colour_changed

Callback event: wxSysColourChangedEvent

wxTree() = #wxTree{type=wxEventType(), item=integer(), itemOld=integer(), pointDrag={X::integer(), Y::integer()}}
EventType:

command_tree_begin_drag, command_tree_begin_rdrag, command_tree_begin_label_edit, command_tree_end_label_edit, command_tree_delete_item, command_tree_get_info, command_tree_set_info, command_tree_item_expanded, command_tree_item_expanding, command_tree_item_collapsed, command_tree_item_collapsing, command_tree_sel_changed, command_tree_sel_changing, command_tree_key_down, command_tree_item_activated, command_tree_item_right_click, command_tree_item_middle_click, command_tree_end_drag, command_tree_state_image_click, command_tree_item_gettooltip, command_tree_item_menu

Callback event: wxTreeEvent

wxUpdateUI() = #wxUpdateUI{type=wxEventType()}
EventType:

update_ui

Callback event: wxUpdateUIEvent

wxWindowCreate() = #wxWindowCreate{type=wxEventType()}
EventType:

create

Callback event: wxWindowCreateEvent

wxWindowDestroy() = #wxWindowDestroy{type=wxEventType()}
EventType:

destroy

Callback event: wxWindowDestroyEvent

Functions


connect(This::wxEvtHandler(), EventType::wxEventType()) -> ok

connect(This::wxEvtHandler(), EventType::wxEventType(), Options::[Options]) -> ok

This function subscribes the to events of EventType, in the range id, lastId. The events will be received as messages if no callback is supplied.

Options: {id, integer()}, The identifier (or first of the identifier range) to be associated with this event handler. Default ?wxID_ANY {lastId, integer()}, The second part of the identifier range. If used 'id' must be set as the starting identifier range. Default ?wxID_ANY {skip, boolean()}, If skip is true further event_handlers will be called. This is not used if the 'callback' option is used. Default false. {callback, function()} Use a callback fun(EventRecord::wx(), EventObject::wxObject()) to process the event. Default not specfied i.e. a message will be delivered to the process calling this function. {userData, term()} An erlang term that will be sent with the event. Default: [].

disconnect(This::wxEvtHandler()) -> true | false

Equivalent to disconnect(This, null, []) Can also have an optional callback Fun() as an additional last argument.

disconnect(This::wxEvtHandler(), EventType::wxEventType()) -> true | false

disconnect(This::wxEvtHandler(), EventType::wxEventType(), Opts) -> true | false

See external documentation This function unsubscribes the process or callback fun from the event handler. EventType may be the atom 'null' to match any eventtype. Notice that the options skip and userdata is not used to match the eventhandler.

View Functions