Re: [gtk-list] Re: Sending arbitrary events to widgets




Okay, I can now send events, but aparently not all the handlers get
executed.  

My goal is to send a 'button-press-event' to a menu and have the menu
drop.  At the moment, I can send a filled-out GtkEventButton and it gets
caught by the button-press-event handler I set with gtk_signal_connect().
However, the handler (or whatever it is) that actually drops down the menu
is not getting called.  

Can someone explain how to get this to happen? Or at least describe a
method of dropping a standard menu down on request (without mouse/keyboard
interaction)?

thanks,
af

On Sun, 18 Apr 1999, Havoc Pennington wrote:

> 
> On Sun, 18 Apr 1999, Adam Fritzler wrote:
> > 
> > Is it possible to send an event (like a key press/click) to a widget using
> > only gtk routines? (ie, the event never actually happens, but the widget
> > thinks it did and acts normally)
> >
> 
> gtk_widget_event() should more or less work; you are going to have to
> synthesize a sane GdkEvent though (just make sure all the fields are
> filled with non-garbage). It won't be *exactly* like a normal event; some
> processing is in the main loop, grep for gtk_widget_event in gtkmain.c to
> see when Gtk actually calls it and in what contexts. For example,
> propagation of events from children to parents is done in gtkmain.c.
>  
> > gtk_signal_emit*() seem to be going in the wrong direction (aparently they
> > emit a signal _from_ a widget instead of the desired _to_ a widget).  
> > 
> 
> gtk_widget_event() is going to call gtk_signal_emit() for the widget's
> "event" signal; it will also call it for the specific event type signal
> (such as "button_press_event") and it will handle some destroy/refcount
> issues. Check it out in gtkwidget.c to get a sense of things.
> 
> Signals are both "from" and "to" in a sense; emitting a signal will
> generally run any user-installed handlers as well as the default handlers
> defined by the GtkObject itself.
> 
> Havoc
> 
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 



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