You'll need to look at the arg(s) "passed" to your button_press event handler.
What you want to check for is the 'Gdk.EventType.TwoButtonPress' value.
Also, note that a double click actually generates multiple events...  
This talks about the events sequencing:
http://www.go-mono.com/docs/[EMAIL PROTECTED]

You'll have to look at the "array" of GLib.SignalArgs.Args, which I think is 
intended to deal with event queueing, although I don't think I've ever seen 
more that one event in the list, but I guess that depends on how fast you are 
processing them.  You'll want some logic similar to this, I believe:
(Note that handler is hooked to widget_event instead of button_event, so it 
will catch key_press events and even mouse_move events, which I was interested 
in for my application)

   void OnWidgetEvent(object o, GLib.SignalArgs args)  //HANDLES ALL WIDGET 
EVENTS
   {
     Gdk.Event gdkEvent;

      Gtk.Widget wdgt = (Gtk.Widget) o;

      //Console.WriteLine("on_widget_event has fired...");
      foreach(object argObj in args.Args)
      {
         // For now, we'll filter ALL Widget events except the ones that we 
(plan/know_how) to handle
         System.Type sysType = argObj.GetType();   
         if( (sysType == typeof(Gdk.EventButton))
         ||  (sysType == typeof(Gdk.EventKey)) )
         {
            gdkEvent = (Gdk.Event) argObj;
            switch(gdkEvent.Type)
            {
               case Gdk.EventType.ButtonPress:
                  // handle the event as desired here...
                  break;

               case Gdk.EventType.TwoButtonPress:
                  // handle the event as desired here...
                  break;

               case Gdk.EventType.ThreeButtonPress:
                  // handle the event as desired here...
                  break;

               case Gdk.EventType.ButtonRelease:
                  // handle the event as desired here...
                  break;
            
               case Gdk.EventType.KeyPress:
                  // handle the event as desired here...
                  break;

               case Gdk.EventType.KeyRelease:
                  // handle the event as desired here...
                  break;
            }
         }
      }
   }


Hope this helps...
Wes

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thomas Zühlke
Sent: Tuesday, April 18, 2006 2:24 AM
To: [email protected]
Subject: [Gtk-sharp-list] left mousebutton double-click

Hi *,

I have a Gtk.DrawingArea and I want to recognize a normal double-click with the 
left mousebutton. On the Mono-Doc helppage: 
http://www.go-mono.com/docs/[EMAIL PROTECTED]
for ButtonPressEvent is nothing written (not documented yet).
I have connected to the ButtonPressEvent and I know the pressed button with 
"args.Event.Button == 1", but there seems to be no way to detect a one-click or 
a double-click event?!

Thx, Thomas
_______________________________________________
Gtk-sharp-list maillist  -  [email protected] 
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list


_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to