Re: Newbie needs help: gtk_entry's stopped accepting key stroke entires

2007-05-12 Thread Gabriel Schulhof
Hi!

On Wed, 2007-05-09 at 12:41 +0200, Sven Neumann wrote:
 Your code returns TRUE from the event handler. This stops signal
 emission and keeps other handlers from being invoked. Check the
 documentation of GtkWidget::key-press-event (or any other event signal
 handler).

... but could it be that in older versions of GTK the default handler
was being called first and it returned FALSE, whereas in newer versions,
the default handler is being called last and so, if an earlier handler
returns TRUE, the default handler never gets called ?



Gabriel

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Newbie needs help: gtk_entry's stopped accepting key stroke entires

2007-05-09 Thread crazyluke

FIXED!! I hope the moderator leaves this on the forum: It was not
Google-able ... just in case someone else pulls a bone-head move like I did.

This code was working as a key event handler:

static int key_pressed3(GtkWidget* w, GdkEventKey* event, gpointer data) {
if (event-keyval == 65293)
actionOptions(w, data);
return true;
}

... later ... in the signal area:

gtk_signal_connect(GTK_OBJECT(dialog), key_press_event,
GTK_SIGNAL_FUNC(key_pressed3), dialog);

It turns out that this is either not needed, depreciated, or just plain
wrong. I'm sure that I borrowed this from someone 4 years ago. Some things
definitely changed with GTK over the last 4 years. Commenting out the
signal_connect line restored my keyboard keypress events for all of my
gtk_entry textboxes. It would still be cool if someone vastly more
knowledgable than me could add a note to this thread explaining why this
code worked 4 years ago, what it did 4 years ago, and why it doesn't work
now.

Later -

Luke


crazyluke wrote:
 
 I developed a GTK+ app about 4 years ago that worked well. It was probably
 built under GTK ~2.4 or 2.6. I just setup the latest version of Dev-Cpp
 compiler with GTK 2.10. I recompiled the old source files. Everything
 works fine except for one MAJOR thing: All of the gtk_entry textbox
 widgets will not take characters entered via keyboard. Here is the
 behavior:
 
 -- You can click in gtk_entry boxes and get a flashing insertion carat in
 any of them
 -- You can use the mouse to highlight 'gtk_entry_set_text' text in the
 boxes or part of the text that is set into a field
 -- You can drag-and-drop text with the mouse field-to-field -- and any
 changed values are pulled later (e.g., a box has a '1' in it; you
 drag-and-drop a '0' out of another field to that field, a '10' comes back
 when the field is checked with a 'gtk_entry_get_text'
 -- gtk_entry_set_editable (discontinued) and gtk_editable_set_editable
 have no affect (true or false)
 -- Fields seem to respond normally to other settings (e.g., they can be
 enabled/disabled, made invisible/visible, etc.)
 -- Other widgets in the window work perfectly: checkboxes, radiobuttons,
 regular buttons
 
 Everything about these fields is normal, except that no characters appear
 when pressing any keys on the keyboard.
 
 The field setup is pretty straightforward:
 
 GtkWidget *CreateTextEntry(const char *s) {
   GtkWidget *w = gtk_entry_new();
   gtk_entry_set_text(GTK_ENTRY(w), s);
   //gtk_entry_set_editable(GTK_ENTRY(w), TRUE); //discontinued
   gtk_editable_set_editable(GTK_EDITABLE(w), TRUE);
   return w;
 }
 
 Am I missing some sort of new gtk_entry signal/keyboard hookup?
 
 Is there something wrong with my old code for this window's events that
 would let everything else work but not keyboard entries?
 
   gtk_widget_show_all(dialog);
   gtk_main();
   gtk_widget_destroy(dialog);
   while (gtk_events_pending()) gtk_main_iteration();
   return gGTKAnswer;
 
 Or, is this going to be some sort of library/dll/compiler settings issue?
 
 I'm STUCK!
 
 Luke
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Newbie-needs-help%3A-gtk_entry%27s-stopped-accepting-key-stroke-entires-tf3708587.html#a10380489
Sent from the Gtk+ - Dev - General mailing list archive at Nabble.com.

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Newbie needs help: gtk_entry's stopped accepting key stroke entires

2007-05-09 Thread Sven Neumann
Hi,

On Tue, 2007-05-08 at 10:46 -0700, crazyluke wrote:

 This code was working as a key event handler:
 
 static int key_pressed3(GtkWidget* w, GdkEventKey* event, gpointer data) {
   if (event-keyval == 65293)
   actionOptions(w, data);
   return true;
 }

Your code returns TRUE from the event handler. This stops signal
emission and keeps other handlers from being invoked. Check the
documentation of GtkWidget::key-press-event (or any other event signal
handler).

BTW, this would have been more appropriate to ask on gtk-list or
gtk-app-devel-list as this list is about development of GTK+, not about
development using GTK+.


Sven


___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Newbie needs help: gtk_entry's stopped accepting key stroke entires

2007-05-08 Thread crazyluke

I developed a GTK+ app about 4 years ago that worked well. It was probably
built under GTK ~2.4 or 2.6. I just setup the latest version of Dev-Cpp
compiler with GTK 2.10. I recompiled the old source files. Everything works
fine except for one MAJOR thing: All of the gtk_entry textbox widgets will
not take characters entered via keyboard. Here is the behavior:

-- You can click in gtk_entry boxes and get a flashing insertion carat in
any of them
-- You can use the mouse to highlight 'gtk_entry_set_text' text in the boxes
or part of the text that is set into a field
-- You can drag-and-drop text with the mouse field-to-field -- and any
changed values are pulled later (e.g., a box has a '1' in it; you
drag-and-drop a '0' out of another field to that field, a '10' comes back
when the field is checked with a 'gtk_entry_get_text'
-- gtk_entry_set_editable (discontinued) and gtk_editable_set_editable have
no affect (true or false)
-- Fields seem to respond normally to other settings (e.g., they can be
enabled/disabled, made invisible/visible, etc.)
-- Other widgets in the window work perfectly: checkboxes, radiobuttons,
regular buttons

Everything about these fields is normal, except that no characters appear
when pressing any keys on the keyboard.

The field setup is pretty straightforward:

GtkWidget *CreateTextEntry(const char *s) {
GtkWidget *w = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(w), s);
//gtk_entry_set_editable(GTK_ENTRY(w), TRUE); //discontinued
gtk_editable_set_editable(GTK_EDITABLE(w), TRUE);
return w;
}

Am I missing some sort of new gtk_entry signal/keyboard hookup?

Is there something wrong with my old code for this window's events that
would let everything else work but not keyboard entries?

gtk_widget_show_all(dialog);
gtk_main();
gtk_widget_destroy(dialog);
while (gtk_events_pending()) gtk_main_iteration();
return gGTKAnswer;

Or, is this going to be some sort of library/dll/compiler settings issue?

I'm STUCK!

Luke


-- 
View this message in context: 
http://www.nabble.com/Newbie-needs-help%3A-gtk_entry%27s-stopped-accepting-key-stroke-entires-tf3708587.html#a10372623
Sent from the Gtk+ - Dev - General mailing list archive at Nabble.com.

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list