[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Moving the curser in a GtkText box



Gert wrote:

> Aaron Kennedy wrote:
> >
> > Does anyone know how to move the actual "flashing curser", that is the
> > one the user sees, in a GtkText box.  I know about gtk_text_set_point(),
> > but that only seems to set the point so gtk_text_insert() can put text
> > in, it doesn't actually move the flashing curser.
> >
> > Am I missing something?
>
> I believe you should use  gtk_editable_set_position(GTK_EDITABLE(yout_text),
> pos);
>
> > Thanks,
> > Aaron
> >
> > --
> >          To unsubscribe: mail gtk-app-devel-list-request@redhat.com with
> >                        "unsubscribe" as the Subject.
> >
> >         Mailing list concerns should be mailed to <listmaster@redhat.com>
>
> --
> -------------------------------------------------------------------------------
>    ~     Gert, Gs2, The Blue Mage - whatever you prefer
>   'v'    E-Mail   : Gs2@dds.nl
>  // \\    Computer : nowmoo.demon.nl
> /(   )\  Project  : gMOO, a MOO (and MUD) client for the unises
>  ^`~'^   HomePage : http://www.nowmoo.demon.nl
>
> --
>          To unsubscribe: mail gtk-app-devel-list-request@redhat.com with
>                        "unsubscribe" as the Subject.
>
>         Mailing list concerns should be mailed to <listmaster@redhat.com>

Thanks, that was certainly the function I was looking for.  I think the reason I
didn't find it was I thought I had tried it... obviously not though ;)

I have another problem though...
Can anyone tell me why this code works as expected (ie.  the curser stays at
position 1)

#include <gtk/gtk.h>

int change(GtkWidget *, gpointer);

GtkWidget *text;

int main(int argc, char **argv)
{
   GtkWidget *window;

   gtk_init(&argc, &argv);

   window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
   text=gtk_text_new(NULL, NULL);


   gtk_text_set_editable(GTK_TEXT(text), TRUE);

   gtk_container_add(GTK_CONTAINER(window), text);
   gtk_widget_show(text);
   gtk_widget_grab_focus(text);
   gtk_signal_connect(GTK_OBJECT(text), "changed",
                      GTK_SIGNAL_FUNC(change), NULL);
   gtk_widget_show(window);
   gtk_main();
}

int change(GtkWidget *widget, gpointer data)
{
   gtk_editable_set_position(GTK_EDITABLE(text), 0);
   return 0;
}


However, if the gtk_signal_connect() is changed to connect to the signal
"insert-text"  as opposed to "changed", it wont work...

Any ideas?

Aaron



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]