Re: gtk_editable_insert_text()



On Fri, 23 Mar 2001, Marcelo CB wrote:

<...>
I will get the expected result. But if I use an intermediary gint to hold
the value of "pos" the text will be inserted but he cursor wont move.

//
gint position;
position = *pos;
gtk_editable_insert_text (editable, text, length, &position);
//

So I understand that gtk_editable_insert_text() must get a pointer to this
int that is used to set the cursor position somewhere ahead and comes from?
<...>

This is just a guess, but perhaps the GtkText widget is storing the
pointer rather than making a copy of what it points to.  In that case when
the callback returns (which will be before the widget is updated) the
pointer becomes invalid.  This is easily tested:  try declaring the
variable 'position' as static in the function.

Otherwise I can't see anything wrong in your code (but note I'm not very
familiar with GtkText or GtkEditable).

Hope this helps

Jonathan








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