On Tue, Dec 22, 2009 at 12:47:55PM +0200, maxim maxim wrote: > I have a following question, I try to receive a cursor position in > GtkEntry by function gtk_editable_get_position (GTK_EDITABLE (entry)), > but the function returns a correct position only at expose-event, in > all other cases it returns a zero, Demonstrate. The attached program demonstrates it works as expected. Yeti ================================================================= #include <gtk/gtk.h> static void get_position(GtkEntry *entry) { g_print("pos: %d\n", gtk_editable_get_position(GTK_EDITABLE(entry))); } int main(int argc, char *argv[]) { GtkWidget *window, *box, *entry, *button; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); box = gtk_vbox_new(FALSE, 4); gtk_container_add(GTK_CONTAINER(window), box); entry = gtk_entry_new(); gtk_container_add(GTK_CONTAINER(box), entry); button = gtk_button_new_with_mnemonic("_Get Position"); gtk_container_add(GTK_CONTAINER(box), button); g_signal_connect_swapped(button, "clicked", G_CALLBACK(get_position), entry); gtk_widget_show_all(window); gtk_main(); return 0; } ================================================================= _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list