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

Re: Emitting a keypress event




Kent Schumacher <kent@structural-wood.com> writes:
> 
> Basically I want to have a toolbar button act exactly as if the user
> had pressed F3 or F4.
> 

If F3 and F4 are accelerators, they are eventually just going to emit
"clicked" on the toolbar button, so you can call gtk_button_clicked()
on it.

To synthesize a key event, you probably want to copy something like
gtk_drawing_area_send_configure in gtk+/gtk/gtkdrawingarea.c, and you
want to send the key event to the toplevel window the toolbar is
inside. However I'm not sure how public gtk_widget_event() is
considered to be.

Do not do something like gtk_signal_emit(widget, "key_press_event")
that will not work (or even if it works it's conceptually broken). You
have to use gtk_widget_event() to emit the event signals.

Havoc



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