Re: [Vala] widgets emitting signals



Hi Karl,

On Sat, 2008-11-22 at 12:54 +0000, Karl Lattimer wrote:
I'm working on a GTK Widget in vala and was wondering if anyone can
point me somewhere or give me a hint as to how I emit signals in vala.

For instance, some event occurs inside of my widget as a result of a
user event or a timed interlude and the widget emits a signal which can
be caught and dealt with.

In one example I want to emit a "selection-changed" signal after
responding to a button-release event. This doesn't seem to be in the
custom widget example code here
http://live.gnome.org/Vala/GTKSample#head-88a57e061a4cc9b5cbe5c5c2f7a41cb78f6cccd2 but probably should be 
there as it is an important part of writing custom widgets.

public class Foo : Object {
        // declare signal, if not inherited from base class
        public signal void selection_changed ();

        public void bar () {
                // emit signal
                this.selection_changed ();
        }
}

Jürg




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