contents up previous next

wxnotebookevent

this class represents the events generated by a notebook control: currently, there are two of them. the page_changing event is sent before the current page is changed. it allows the program to examine the current page (which can be retrieved with getoldselection()) and to veto the page change by calling veto() if, for example, the current values in the controls of the old page are invalid.

the second event - page_changed - is sent after the page has been changed and the program cannot veto it any more, it just informs it about the page change.

to summarize, if the program is interested in validating the page values before allowing the user to change it, it should process the page_changing event, otherwise page_changed is probably enough. in any case, it is probably unnecessary to process both events at once.

derived from

wxnotifyevent
wxcommandevent
wxevent
wxobject

include files

<wx/notebook.h>

event handling

to process input from a notebook control, use the following event handler macros to direct input to member functions that take a wxnotebookevent argument.

evt_notebook_page_changed(id, func) the page selection was changed. processes a wxevt_command_notebook_page_changed event.
evt_notebook_page_changing(id, func) the page selection is about to be changed. processes a wxevt_command_notebook_page_changing event. this event can be vetoed.

see also

wxnotebook

members

wxnotebookevent::wxnotebookevent
wxnotebookevent::getoldselection
wxnotebookevent::getselection
wxnotebookevent::setoldselection
wxnotebookevent::setselection


wxnotebookevent::wxnotebookevent

wxnotebookevent(wxeventtype eventtype = wxevt_null, int id = 0, int sel = -1, int oldsel = -1)

constructor (used internally by wxwidgets only).


wxnotebookevent::getoldselection

int getoldselection() const

returns the page that was selected before the change, -1 if none was selected.


wxnotebookevent::getselection

int getselection() const

returns the currently selected page, or -1 if none was selected.

nb: under windows, getselection() will return the same value as getoldselection() when called from evt_notebook_page_changing handler and not the page which is going to be selected. also note that the values of selection and old selection returned for an event generated in response to a call to wxnotebook::setselection shouldn't be trusted as they are currently inconsistent under different platforms (but in this case you presumably don't need them anyhow as you already have the corresponding information).


wxnotebookevent::setoldselection

void setoldselection(int page)

sets the id of the page selected before the change.


wxnotebookevent::setselection

void setselection(int page)

sets the selection member variable.

see also

wxnotebookevent::getselection