]>
Commit | Line | Data |
---|---|---|
1 | \section{\class{wxNotebookEvent}}\label{wxnotebookevent} | |
2 | ||
3 | This class represents the events generated by a notebook control: currently, | |
4 | there are two of them. The PAGE\_CHANGING event is sent before the current | |
5 | page is changed. It allows to the program to examine the current page (which | |
6 | can be retrieved with | |
7 | \helpref{GetOldSelection()}{wxnotebookeventgetoldselection}) and to veto the page | |
8 | change by calling \helpref{Veto()}{wxnotifyeventveto} if, for example, the | |
9 | current values in the controls of the old page are invalid. | |
10 | ||
11 | The second event - PAGE\_CHANGED - is sent after the page has been changed and | |
12 | the program cannot veto it any more, it just informs it about the page change. | |
13 | ||
14 | To summarize, if the program is interested in validating the page values | |
15 | before allowing the user to change it, it should process the PAGE\_CHANGING | |
16 | event, otherwise PAGE\_CHANGED is probably enough. In any case, it is probably | |
17 | unnecessary to process both events at once. | |
18 | ||
19 | {\bf NB:} under Windows, GetSelection() will return the same value as | |
20 | GetOldSelection() when called from PAGE\_CHANGING handler and not the page | |
21 | which is going to be selected if the handler doesn't call Veto(). | |
22 | ||
23 | \wxheading{Derived from} | |
24 | ||
25 | \helpref{wxNotifyEvent}{wxnotifyevent}\\ | |
26 | \helpref{wxCommandEvent}{wxcommandevent}\\ | |
27 | \helpref{wxEvent}{wxevent}\\ | |
28 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
29 | \helpref{wxObject}{wxobject} | |
30 | ||
31 | \wxheading{Include files} | |
32 | ||
33 | <wx/notebook.h> | |
34 | ||
35 | \wxheading{Event table macros} | |
36 | ||
37 | To process a notebook event, use these event handler macros to direct input to member | |
38 | functions that take a wxNotebookEvent argument. | |
39 | ||
40 | \twocolwidtha{7cm} | |
41 | \begin{twocollist}\itemsep=0pt | |
42 | \twocolitem{{\bf EVT\_NOTEBOOK\_PAGE\_CHANGED(id, func)}}{The page selection was changed. Processes a | |
43 | wxEVT\_COMMAND\_NOTEBOOK\_PAGE\_CHANGED event.} | |
44 | \twocolitem{{\bf EVT\_NOTEBOOK\_PAGE\_CHANGING(id, func)}}{The page selection is about to be changed. | |
45 | Processes a wxEVT\_COMMAND\_NOTEBOOK\_PAGE\_CHANGING event. This event can be \helpref{vetoed}{wxnotifyeventveto}.} | |
46 | \end{twocollist}% | |
47 | ||
48 | \wxheading{See also} | |
49 | ||
50 | \helpref{wxNotebook}{wxnotebook}, \helpref{wxTabCtrl}{wxtabctrl}, \helpref{wxTabEvent}{wxtabevent} | |
51 | ||
52 | \latexignore{\rtfignore{\wxheading{Members}}} | |
53 | ||
54 | \membersection{wxNotebookEvent::wxNotebookEvent}\label{wxnotebookeventconstr} | |
55 | ||
56 | \func{}{wxNotebookEvent}{\param{wxEventType}{ eventType = wxEVT\_NULL}, | |
57 | \param{int}{ id = 0}, \param{int}{ sel = -1}, \param{int}{ oldSel = -1}} | |
58 | ||
59 | Constructor (used internally by wxWindows only). | |
60 | ||
61 | \membersection{wxNotebookEvent::GetOldSelection}\label{wxnotebookeventgetoldselection} | |
62 | ||
63 | \constfunc{int}{GetOldSelection}{\void} | |
64 | ||
65 | Returns the page that was selected before the change, -1 if none was selected. | |
66 | ||
67 | \membersection{wxNotebookEvent::GetSelection}\label{wxnotebookeventgetselection} | |
68 | ||
69 | \constfunc{int}{GetSelection}{\void} | |
70 | ||
71 | Returns the currently selected page, or -1 if none was selected. | |
72 | ||
73 | \membersection{wxNotebookEvent::SetOldSelection}\label{wxnotebookeventsetoldselection} | |
74 | ||
75 | \func{void}{SetOldSelection}{\param{int}{ page}} | |
76 | ||
77 | Sets the id of the page selected before the change. | |
78 | ||
79 | \membersection{wxNotebookEvent::SetSelection}\label{wxnotebookeventsetselection} | |
80 | ||
81 | \func{void}{SetSelection}{\param{int}{ page}} | |
82 | ||
83 | Sets the selection member variable. | |
84 | ||
85 | \wxheading{See also} | |
86 | ||
87 | \helpref{wxNotebookEvent::GetSelection}{wxnotebookeventgetselection} | |
88 | ||
89 |