dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]WndProc


From: Rhys Weatherley
Subject: Re: [DotGNU]WndProc
Date: Sat, 14 Jun 2003 11:48:51 +1000
User-agent: KMail/1.4.3

On Saturday 14 June 2003 11:27 am, Hector wrote:
> I'm trying to implement tabcontrol and tabpage, but tabcontrol overrides
> control.wndproc. Whats the official position about wndproc, also if you
> are not using wndproc how your are managing the events?

For now, just make the TabControl.WndProc call through to "base.WndProc" and 
leave it like that.  See the bottom of "ButtonBase.cs" for an example.

Events are delivered from the toolkit to the "Control" class, which then 
dispatches events via the "OnXXX" methods.  You override these methods and 
viola!, events work!

For a more concrete example, here is what happens when you click the mouse 
button in a control:

- Xsharp intercepts the X event and dispatches it to "OnButtonPress"
  in the "DrawingWindow" class.
- "DrawingWindow.OnButtonPress" calls "ToolkitMouseDown" on its event
  sink, which is the "Control" instance ("Control" implements
  "IToolkitEventSink").
- "Control.ToolkitMouseDown" calls "OnMouseDown" and we are now in
  WinForms land, handling WinForms events.

(Aside: this is a lot more efficient than my first attempt, which used lots 
and lots of delegates).

The "WndProc" method is completely bypassed at the moment.  We may need to 
implement it later if there is some dumb Windows programmer out there who 
says "Hey!  I can just override the WM_FOOBAR message in WndProc!" and there 
is no "OnFooBar" method in the WinForms API.  We'll cross that road when we 
get to it - don't worry about it for now.

Cheers,

Rhys.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]