Re: combo box
- From: Alexey Semenov <swajj yahoo com>
- To: gtk-list gnome org
- Subject: Re: combo box
- Date: Mon, 1 Oct 2001 11:23:16 +0300 (EEST)
> >my_func (GtkWidget* widget, GdkEventKey* event, gpointer data)
> >{
> > switch (event->keyval) {
> > ...
> > case GDK_Up:
> >
> > ... do smth. usefull, then i'd like to supress Up ...
> >
> > gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "key_press_event");
> > gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "key_release_event")
> >;
> > break;
> > ...
> >}
> >
> >... to prevent focus moving out of entry.
> >all works, but i'm getting:
> >
> >Gtk-WARNING **: gtk_signal_emit_stop(): no current emission (27) for object `G
> >tkEntry'
>
> You are trying to stop emissions on both key_press and key_release,
> but when this function is called, only one of these is being emitted.
>
> >From the connect code you showed, you should only be stopping
> key_press events. If you use the same signal handler for key_release
> as well, you should test the event->type, and only block the correct
> (relevant) emission.
my_func is signal handler for both - key press and key_release
events, but only key_press is active all the time
if i try to define what kind of event inside my_func()
if (event->type == GDK_KEY_PRESS) {
printf("press");
}
if (event->type == GDK_KEY_RELEASE) {
printf("release");
}
release never appears and after press <Up> focus goes out (it goes out
right afrer key_press, before release <Up> button !)
maube smth. special when i connect signals? currently i do like that:
gtk_signal_connect_object(GTK_OBJECT (GTK_ENTRY(GTK_COMBO(combo1)->entry )) , "key_press_event",
GTK_SIGNAL_FUNC(my_func),GTK_OBJECT(GTK_ENTRY(GTK_COMBO(combo1)->entry)));
gtk_signal_connect_object(GTK_OBJECT (GTK_ENTRY(GTK_COMBO(combo1)->entry )) , "key_release_event",
GTK_SIGNAL_FUNC(my_func),GTK_OBJECT(GTK_ENTRY(GTK_COMBO(combo1)->entry)));
if i remove
gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "key_release_event")
- no more Gtk-Warnings, but focus goes out of combo's entry area.
any ideas?
---
See you later...
Alexey.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]