File: port21.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (20 lines) | stat: -rw-r--r-- 1,247 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<HTML>
<head><title>OnEvent</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="topic11"></A><CENTER>
<A HREF="port.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="port14.htm#quickreference"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="port20.htm#topic10"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="port22.htm#topic12"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>OnEvent</H2>
<P>
This is now a non-virtual function, with the same wxMouseEvent&amp; argument as before. However
you may wish to rename it OnMouseEvent. Add an EVT_MOUSE_EVENTS macro to the event table
for your window, and the implementation of your function will need very few changes.
However, if you wish to intercept different events using different functions, you can
specify specific events in your event table, such as EVT_LEFT_DOWN.<P>
Your OnEvent function is likely to have references to GetDC(), so make sure you create
a wxClientDC instead. See <A HREF="port9.htm#dc">Device contexts</A>.<P>
If you are using a wxScrolledWindow (formerly wxCanvas), you should call
PrepareDC(dc) to set the correct translation for the current scroll position.<P>

</BODY></HTML>