How to solve this problem?



Hello, everybody

I want to write a small editor. It will use only one gtktextview, and a
lot of gtktextbuffer is created and stored in a pglist variable.
I can use gtk_text_view_set_buffer to show different buffer on the
gtktextview, but the problem is to ensure the correct position of the
text in the view(when a buffer is put into view, the position is always
at the very first of the text). Before one new gtktextbuffer is put into
the gtktextview, the old one's position (i.e. cursor position, the
currently showed screen position, the hadjustment and vadjustment
position) should be recorded, and later when it is put into the
gtktextview again, those values should be restored. But I failed to
implement it. The position restored is not corrent, especially when
those texts has different bytes. I need to make all at the positions
exactly the same as before it was suspended out, so the users will not
notice that those contents actually use the same gtktextview.
I used the following functions:
gtk_text_view_set_buffer
gtk_adjustment_get_value
gtk_adjustment_set_value
gtk_scrolled_window_get_hadjustment
gtk_scrolled_window_get_vadjustment
gtk_text_buffer_get_insert
gtk_text_buffer_get_iter_at_mark
gtk_text_view_scroll_to_mark
gtk_text_view_scroll_to_iter

Can anybody give me a good sugguestion to implement what I want?
Thank you very much,

Best Regards,
Kenny








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