Re: [Vala] example request



Reid Thompson wrote:
Can anyone point me to an example where i can see something along the
lines of  ... hey, this changed (in my case the text buffer), do this as
a results ...

TextBuffer has a 'changed' and a 'modified_changed' signal:
http://valadoc.org/gtk+-2.0/Gtk.TextBuffer.changed.html
http://valadoc.org/gtk+-2.0/Gtk.TextBuffer.modified_changed.html

If you have a TextView you can connect a handler to one of those signals
of its buffer:

        var textview = new TextView ();
        textview.buffer.changed.connect (on_buffer_changed);

And the handler:

        void on_buffer_changed (TextBuffer buffer) {
                // Save text
        }


If you're doing this with Glade, then you must create a text buffer
object (there's a section in the tool palette on the left side) and reference
this buffer object in the properties pane of the text view (on the right side).


Best regards,

Frederik



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