Pretty straight forward question, I have a GtkEntry
widget that I want to set to be editable. I know the function I should use is:
gtk_editable_set_editable
But I don't know how to make it take a GtkEntry
widget as an argument
Here is the code I'm using:
GtkWidget *TextEntry;
TextEntry = gtk_entry_new();
gtk_entry_set_visibility(GTK_ENTRY(TextEntry), TRUE);
gtk_entry_set_editable(GTK_ENTRY(TextEntry), TRUE);
gtk_entry_set_overwrite_mode(GTK_ENTRY(TextEntry), TRUE);
gtk_widget_set_can_focus(GTK_WIDGET(TextEntry), TRUE);
gtk_widget_grab_focus(TextEntry);
panel_applet_request_focus(applet, 10);
gtk_container_add (GTK_CONTAINER (applet), TextEntry);
gtk_widget_show_all (GTK_WIDGET (applet));
So far as getting keyboard focus, I think I need the panel_applet_reques开发者_如何学Ct_focus ()
function. It requires that i pass it the applet in question and the timestamp of the event triggering the window focus
I'm not sure what to put in for the timestamp. I compiled the code as above and I still can't get keyboard focus when I click the applet.
Do the following:
GtkWidget* entry = gtk_entry_new();
gtk_entry_set_editable(GTK_ENTRY(entry), TRUE);
Welcome to the world of GObject :)
Note that if you were using gtk_editable, you need to do:
gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE);
精彩评论