Setting cusros position does not work in text_changed callback
- From: Deekshit Mantampady <dmantamp gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Setting cusros position does not work in text_changed callback
- Date: Sun, 2 Oct 2005 13:54:47 +0530
Hi all,
I am not able to set the cursor positon in an entry widget using
gtk_editable_set_position(), inside a textchanged callback. In the
following code, I always set the cursor postion to 0, for each text
changed. But it does not happen.
Please help me.
Thanks in advance
Deekshit M
===========================================
#include <gtk/gtk.h>
gboolean window_deleted(GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
gtk_widget_destroy(widget);
gtk_main_quit();
return FALSE;
}
gboolean text_changed(GtkEditable *editable, gpointer data)
{
gtk_editable_set_position(GTK_EDITABLE(editable), 0);
}
int main(int argc, char *argv[])
{
GtkWidget *window, *vbox, *hbox, *entry;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_signal_connect(GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(window_deleted), NULL);
vbox = gtk_vbox_new(FALSE, 2);
gtk_container_add(GTK_CONTAINER(window), vbox);
gtk_widget_show(vbox);
hbox = gtk_hbox_new(FALSE, 2);
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 2);
gtk_widget_show(hbox);
entry = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 2);
gtk_signal_connect(GTK_OBJECT(entry), "delete_event",
gtk_signal_connect(GTK_OBJECT(entry), "changed",
GTK_SIGNAL_FUNC(text_changed), NULL);
gtk_widget_show(entry);
gtk_widget_show(window);
gtk_main();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]