X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2432b92dd7a837db13d3938a56c1959decd03203..1d836590aa324b7d58481e27a4b1ad6399174a2c:/docs/latex/wx/noteevt.tex diff --git a/docs/latex/wx/noteevt.tex b/docs/latex/wx/noteevt.tex index 04c72ddc8e..04e0a26391 100644 --- a/docs/latex/wx/noteevt.tex +++ b/docs/latex/wx/noteevt.tex @@ -1,51 +1,72 @@ \section{\class{wxNotebookEvent}}\label{wxnotebookevent} -This class represents the events generated by a notebook control. +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 +\helpref{GetOldSelection()}{wxnotebookeventgetoldselection}) and to veto the page +change by calling \helpref{Veto()}{wxnotifyeventveto} 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. \wxheading{Derived from} +\helpref{wxNotifyEvent}{wxnotifyevent}\\ \helpref{wxCommandEvent}{wxcommandevent}\\ \helpref{wxEvent}{wxevent}\\ -\helpref{wxEvtHandler}{wxevthandler}\\ \helpref{wxObject}{wxobject} -\wxheading{Event table macros} +\wxheading{Include files} -To process a notebook event, use these event handler macros to direct input to member -functions that take a wxNotebookEvent argument. + -\twocolwidtha{7cm} -\begin{twocollist}\itemsep=0pt -\twocolitem{{\bf EVT\_NOTEBOOK\_PAGE\_CHANGED(id, func)}}{The page selection was changed. Processes a -wxEVT\_COMMAND\_NOTEBOOK\_PAGE\_CHANGED event.} -\twocolitem{{\bf EVT\_NOTEBOOK\_PAGE\_CHANGING(id, func)}}{The page selection is about to be changed. -Processes a wxEVT\_COMMAND\_NOTEBOOK\_PAGE\_CHANGING event.} -\end{twocollist}% +\input noteevt.inc \wxheading{See also} -\helpref{wxNotebook}{wxnotebook}, \helpref{wxTabCtrl}{wxtabctrl}, \helpref{wxTabEvent}{wxtabevent} +\helpref{wxNotebook}{wxnotebook} \latexignore{\rtfignore{\wxheading{Members}}} + \membersection{wxNotebookEvent::wxNotebookEvent}\label{wxnotebookeventconstr} \func{}{wxNotebookEvent}{\param{wxEventType}{ eventType = wxEVT\_NULL}, - \param{int}{ id = 0}, \param{int}{ sel = -1}, \param{int}{ oldSel = -1}} + \param{int}{ id = 0}, \param{int}{ sel = $-1$}, \param{int}{ oldSel = $-1$}} + +Constructor (used internally by wxWidgets only). -Constructor. \membersection{wxNotebookEvent::GetOldSelection}\label{wxnotebookeventgetoldselection} \constfunc{int}{GetOldSelection}{\void} -Returns the page that was selected before the change, -1 if none was selected. +Returns the page that was selected before the change, $-1$ if none was selected. + \membersection{wxNotebookEvent::GetSelection}\label{wxnotebookeventgetselection} \constfunc{int}{GetSelection}{\void} -Returns the currently selected page, or -1 if none was selected. +Returns the currently selected page, or $-1$ if none was selected. + +{\bf NB:} under Windows, GetSelection() will return the same value as\rtfsp +\helpref{GetOldSelection()}{wxnotebookeventgetoldselection} when called from +{\tt 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 +\helpref{wxNotebook::SetSelection}{wxnotebooksetselection} 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). + \membersection{wxNotebookEvent::SetOldSelection}\label{wxnotebookeventsetoldselection} @@ -53,6 +74,7 @@ Returns the currently selected page, or -1 if none was selected. Sets the id of the page selected before the change. + \membersection{wxNotebookEvent::SetSelection}\label{wxnotebookeventsetselection} \func{void}{SetSelection}{\param{int}{ page}}