I have a dialog box with GtkEntry. I want to select all the text in the record immediately after the dialog box becomes visible to the user. I tried this, but its not working, I don't see a choice:
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 to select text in GtkEntry after GtkDialog becomes visible?
source
share