i have dialog window with GtkEntry. I want to select all text in entry right after dialog window becomes visible to user. I tried this, but its not working, i see no selection:
static void OnEntryShow(GtkWidget *entry, gpointer user_data)
{
gtk_editable_select_region(GTK_EDITABLE(entry), 0, -1);
}
...
gtk_entry_set_text(GTK_ENTRY(myEntry), "text");
g_signal_connect(myEntry, "show", G_CALLBACK(OnEntryShow), NULL);
if (gtk_dialog_run(GTK_DIALOG(myDialog)) == GTK_RESPONSE_OK)
...
How can i select text in GtkEntry after GtkDialog becomes visible?
Perhaps you want the GtkEntry to grab focus?
Try this:
gtk_widget_grab_focus (entry);
where entry
is in this case the pointer to your GtkEntry widget.
The documentation of the function can be found here.