Kevin Ryde
and 1 contributors


Glib::Ex::ConnectProperties::Element::textbuffer -- TextBuffer character count


 Glib::Ex::ConnectProperties->new([$textbuf, 'textbuffer#empty'],
                                  [$another, 'something']);


This element class implements ConnectProperties access to the following attributes of a Gtk2::TextBuffer.

    textbuffer#empty           boolean, read-only
    textbuffer#not-empty       boolean, read-only
    textbuffer#char-count      integer, read-only

For example textbuffer#not-empty might be connected up to make a "clear" button sensitive only when there is in fact something to clear

      ([$textbuf, 'textbuffer#not-empty'],
       [$button,  'sensitive', write_only => 1]);

These attributes use $textbuf->get_char_count(). Gtk2::TextBuffer doesn't offer this count from a property as such, only a method.

The full text string is available from the text property on the TextBuffer in the usual way. But Gtk circa 2.24.8 doesn't seem to emit a notify for changes to it, only the changed signal. If accessing text with ConnectProperties it may be necessary to use read_signal => "changed" instead of the usual notify.


Glib::Ex::ConnectProperties, Glib::Ex::ConnectProperties::Element::model_rows, Gtk2::TextBuffer



Copyright 2010, 2011, 2012, 2017 Kevin Ryde

Glib-Ex-ConnectProperties is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Glib-Ex-ConnectProperties is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Glib-Ex-ConnectProperties. If not, see