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

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

Later -


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:
Sent from the Gtk+ - Dev - General mailing list archive at

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