Re: Is there an Editor widget available? [OOPS]

On 10/28/00 John McDermott wrote:
Let's try this again.  (I had a crash in there somewhere, sorry).

If I want to use Gtk::Text for this, how do I copy the text out of the
widget?  I cannot get $textwidget->index($n) to resolve and I don't see
it in the code.  Am I missing something?

If you want it all in one chunk:

        $text = $text_widget->get_chars();

or if it's big do it in steps:

        $len = $text_widget->get_length;
        $start = 0;
        while ($start < $len) {
                $text = $text_widget->get_chars($start, $start+2048);
                $start += 2048;
                # do something with $text...

$textwidget->index($n) could be emulated with
$textwidget->get_chars($n, $n+1);
but that would be slow if you want to save the whole buffer
a char at a time.


lupus debian org                                     debian/rules

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