end of line error



G'day,

I'm trying to format text as it is being entered into a text input
widget.

<chunk of code>
sprintf(formatted_line, "%c%c/%c", entry_text[0],
entry_text[1], entry_text[2]);
                                        gtk_entry_set_text(GTK_ENTRY(v->entry), "");
tmp_pos = GTK_ENTRY(v->entry)->text_length;
                                        gtk_editable_insert_text(GTK_EDITABLE(v->entry),
        formatted_line, -1, &tmp_pos);
                                        gtk_editable_set_position(GTK_EDITABLE(v->entry), -1);
</chunk of code>

So if I was to enter:

1234

the widget should appear:

12/34

This code produces:

12/43

No matter what I do after

123

is entered

the screen is:

12/|3

with the insertion curser before the 3.

Now the API says:
gtk_editable_set_position(GTK_EDITABLE(v->entry), -1);

should position the curser at the end of the line.

Any hints, ideas, or suggestions (code snipets, examples url's or
references) greatly appreciated.

Regards,

Ashley




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