]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/cntxtevt.tex
Patches-1851591 ] dataview sample is crashing (under MSW)
[wxWidgets.git] / docs / latex / wx / cntxtevt.tex
1 \section{\class{wxContextMenuEvent}}\label{wxcontextmenuevent}
2
3 This class is used for context menu events, sent to give
4 the application a chance to show a context (popup) menu.
5
6 Note that if \helpref{GetPosition}{wxcontextmenueventgetposition} returns wxDefaultPosition, this means that the event originated
7 from a keyboard context button event, and you should compute a suitable position yourself,
8 for example by calling \helpref{wxGetMousePosition}{wxgetmouseposition}.
9
10 When a keyboard context menu button is pressed on Windows, a right-click event with default position is sent first,
11 and if this event is not processed, the context menu event is sent. So if you process mouse events and you find your context menu event handler
12 is not being called, you could call wxEvent::Skip for mouse right-down events.
13
14 \wxheading{Derived from}
15
16 \helpref{wxCommandEvent}{wxcommandevent}\\
17 \helpref{wxEvent}{wxevent}\\
18 \helpref{wxObject}{wxobject}
19
20 \wxheading{Include files}
21
22 <wx/event.h>
23
24 \wxheading{Library}
25
26 \helpref{wxCore}{librarieslist}
27
28 \wxheading{Event table macros}
29
30 To process a menu event, use these event handler macros to direct input to member
31 functions that take a wxContextMenuEvent argument.
32
33 \twocolwidtha{7cm}
34 \begin{twocollist}\itemsep=0pt
35 \twocolitem{{\bf EVT\_CONTEXT\_MENU(func)}}{A right click (or other context menu command depending on platform) has been detected.}
36 \end{twocollist}
37
38 \wxheading{See also}
39
40 \helpref{Command events}{wxcommandevent},\\
41 \helpref{Event handling overview}{eventhandlingoverview}
42
43 \latexignore{\rtfignore{\wxheading{Members}}}
44
45 \membersection{wxContextMenuEvent::wxContextMenuEvent}\label{wxcontextmenueventctor}
46
47 \func{}{wxContextMenuEvent}{\param{WXTYPE }{id = 0}, \param{int }{id = 0}, \param{const wxPoint\&}{ pos=wxDefaultPosition}}
48
49 Constructor.
50
51 \membersection{wxContextMenuEvent::GetPosition}\label{wxcontextmenueventgetposition}
52
53 \constfunc{wxPoint}{GetPosition}{\void}
54
55 Returns the position in screen coordinates at which the menu should be shown. Use \helpref{wxWindow::ScreenToClient}{wxwindowscreentoclient} to
56 convert to client coordinates. You can also omit a position from \helpref{wxWindow::PopupMenu}{wxwindowpopupmenu} in order to use
57 the current mouse pointer position.
58
59 If the event originated from a keyboard event, the value returned from this function will be wxDefaultPosition.
60
61 \membersection{wxContextMenuEvent::SetPosition}\label{wxcontextmenueventsetposition}
62
63 \func{void}{SetPosition}{\param{const wxPoint\&}{ point}}
64
65 Sets the position at which the menu should be shown.
66