[Mono-list] FW: How to use the method Gdk.Window.AddFilter ???

Frank Gutierrez Domínguez f.gutierrez at lab.matcom.uh.cu
Mon May 23 15:16:43 EDT 2011



From: Frank Gutierrez Domínguez [mailto:f.gutierrez at lab.matcom.uh.cu] 
Sent: Monday, May 23, 2011 3:15 PM
To: 'gtk-sharp-list at lists.ximian.com'
Subject: How to use the method Gdk.Window.AddFilter ???


Hello everybody:

I’m developing a custom widget in Gtk# and I need to capture the events
before they reach the widget, i.e. capture the system messages before the
widget raises the event.

The ones who have experience in Windows Forms would know there this is
accomplished through the IMessageFilter interface. In SWF normally we make
our custom Control inherit from IMessageFilter, then implement the
PreFilterMessage method and in the constructor we call

As I’ve been able to understand searching through various lists and forums I
think this is done in GTK# through the method Gdk.Window.AddFilter wich gets
an instance of the FilterFunc delegate. 

So, in my custom widget I override the OnRealized method and inside it I
call this.GdkWindow.AddFilter(new Gdk.FilterFunc(PreFilterMessage)).

Until there everything is fine, but the problem is in the implementation of
the PreFilterMessage method wich signature is 

public Gdk.FilterReturn PreFilterMessage(IntPtr xEvent, Gdk.Event evnt)




According to the Monodocs the Gdk.Event has some useful properties I can use
to know what type of event I’m dealing with, such as Gdk.Event.Type, but
when I try to access it, it always has the default Nothing value. Does
anybody knows how to work with this method? How can I actually get some
juice of it?

Please, I need this ASAP, ‘cause it’s part of my grade thesis work.

Thanks in advance! 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20110523/8e14b54a/attachment.html 

More information about the Mono-list mailing list