Re: [gtk-list] Saving contents of a textbox...



[snip]
>          for (i=0; i<=(gtk_text_get_length(GTK_TEXT(document->text))-1); i++)
>                  fputc((int) GTK_TEXT(document->text)->text[i], file_handle);
[snip]
>  I really hope I'm not making some blatant mistake that's fix will make me feel
>  like an idiot, but hey, at this point I'm desparate ;) Any help is *much*
>  appreciated... Note also that I haven't upgraded to 0.99.4 yet (using the
>  0.99.3 text widget with the (marius?) patch for deleting line breaks,) so there
>  might have been a bug fix to gtk_text_get_length, but I didn't see anything
>  about it on the list... Thanks a mil!

Ah.  The problem is that you are accessing the text widget's internal
representation of the text without taking into account that it is a
gapped text buffer (yes, that's a mouthful).

You should upgrade to 0.99.4 and use the gtk_editable_get_chars()
function to get chunks out of the text widget and write them to file.
I guess you don't want to just do a gtk_editable_get_chars() on all of
the text at once, because you would be duplicating the buffer in
effect.

  Quartic



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