Re: Send mouse button press event to widget??






David NeÄas (Yeti)-2 wrote:

On Thu, Aug 30, 2007 at 05:24:21AM -0700, eminemence wrote:

I am creating a virtual cursor on a web page and want to simulate the
left
click of the mouse button
when the user presses the enter button.
So I tried even using the gdk_event_put on the global window
itself,assuming
the event would find it's 
way to the control under the cursor.
The gdk_event_put has not been successful,so what is the way to achieve
this?

I don't recall a working example now (the Gtk+ source code
has some though), but:
- create the event with gdk_event_new()
- fill the fields
  - cursor position (in GdkWindow coordinates) can be obtained
    with gdk_window_get_pointer()
  - window fields have to be g_object_ref()ed IIRC as
    something unrefs them later
  - send_event should be TRUE
  - other information can be obtained from the original
    event or other means
- send the event with gtk_widget_event()
- free event
- remember if you send a button presses and no button
  releases, widgets can get confused

Yeti

--
http://gwyddion.net/
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Thanks for the replies.
I was successful in sending an mouse press event to the widget.
But I have noticed only the GDK_BUTTON_PRESS is sent to the button.
And GDK_BUTTON_RELEASE is not sent at all.So as of now the button 
is just getting depressed and is not released,so now how can I make 
the release action to occur?
I have already tried sending the GDK_BUTTON_RELEASE event immediately 
after the PRESS event,like this:
                        gtk_widget_event(GTK_WIDGET(gPage),&eButtonPress);
                        gtk_widget_event(GTK_WIDGET(gPage),&eButtonRelease);
But the release event is getting lost somewhere!!!
Also I have even tried using gtk_main_do_event.



-- 
View this message in context: 
http://www.nabble.com/Send-mouse-button-press-event-to-widget---tf4353330.html#a12459349
Sent from the Gtk+ - Apps Dev mailing list archive at Nabble.com.




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