Gtk: How can I get a part of a file in a textview with scrollbars relating to the full file

Posted by badgerman1 on Stack Overflow See other posts from Stack Overflow or by badgerman1
Published on 2010-04-23T12:43:50Z Indexed on 2010/04/24 7:53 UTC
Read the original article Hit count: 202

Filed under:
|
|

I'm trying to make a very large file editor (where the editor only stores a part of the buffer in memory at a time), but I'm stuck while building my textview object. Basically- I know that I have to be able to update the text view buffer dynamically, and I don't know hot to get the scrollbars to relate to the full file while the textview contains only a small buffer of the file.

I've played with Gtk.Adjustment on a Gtk.ScrolledWindow and ScrollBars, but though I can extend the range of the scrollbars, they still apply to the range of the buffer and not the filesize (which I try to set via Gtk.Adjustment parameters) when I load into textview. I need to have a widget that "knows" that it is looking at a part of a file, and can load/unload buffers as necessary to view different parts of the file. So far, I believe I'll respond to the "change_view" to calculate when I'm off, or about to be off the current buffer and need to load the next, but I don't know how to get the scrollbars to have the top relate to the beginning of the file, and the bottom relate to the end of the file, rather than to the loaded buffer in textview.

Any help would be greatly appreciated, thanks!

© Stack Overflow or respective owner

Related posts about pygtk

Related posts about gtk