Re: A signal for a ComboBoxText



On Tue, Nov 17, 2009 at 3:26 PM, Glus Xof <gtglus gmail com> wrote:
> Hello everybody,
>
> I wrote a Gtk::ComboBoxText (that preferably should remain inside a
> class method scope) that should drive something each time when an
> active element changes. I was trying this doing,
>
> Gtk::ComboBoxText m_comboboxtext;
>
> m_comboboxtext.signal_changed().connect(sigc::bind<Glib::ustring>(sigc::mem_fun(some_object,
> &some_class::method1),
>            m_comboboxtext.get_active_text()));
>
> But Gtk::ComboBoxText::get_active_text() doesn't throw the current
> active element...
>
> What should I change ?

you're making a very, very basic mistake.

bind (mem_fun (obj, &Object::method), other_object.method())

binds the return value that is returned by other_object.method() RIGHT
NOW. it does not "queue" the execution of get_active_text() for later
execution. as a result, yes, you always see the same value in
Object:::method().


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