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

Re: simulating a keypress-event



Clemens Kirchgatterer <clemens@root.at> writes:
>   event.length     = 1;
>   event.string     = "";

You're going to have to do better for length/string; you need to be
putting in the string corresponding to the key.

>   gtk_signal_emit_by_name(GTK_OBJECT(entry_typed), "key_press_event", &event);
>   event.type       = GDK_KEY_RELEASE;
>   event.time       = gdk_time_get();
>   event.state      = GDK_KEY_RELEASE;
>   gtk_signal_emit_by_name(GTK_OBJECT(entry_typed), "key_press_event", &event);
> }
> 

You can't emit these signals yourself. You have to do it via the
public interface, which is gtk_widget_event() to send the event to a
specific widget and gtk_main_do_event() to process the event as it
would normally be processed (propagated up the widget hierarchy).
The segfault is likely just that you're emitting the signal without
passing in a location for the emission return value, but don't worry
about that, just don't call gtk_signal_emit directly.

Havoc





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