For my GUI I have a class to add more functionality to Gtk::Entries. In that class I have a protected boolean variable. I have functions built to adjust the boolean variable to be true or false when it needs to be, this works no problem. When I try to pass that boolean value is where the problem occurs
For instance what did not work is:
((Gtk::Entry *)w)->signal_activate().connect(sigc::bind<Gtk::Widget *>(sigc::mem_fun(*this, &Dialog::function), w2));
The Dialog::function looks like this:
void Dialog::function(Gtk::Widget *w2)
{
if((MyClass *) this)->get_boolean_val())
w2->do_something();
}
Whenver I did this the boolean value would always come back false, even after varifying that the class variable would change. I proved that by editing the above as such.
((Gtk::Entry *)w)->signal_activate().connect(sigc::bind<Gtk::Widget *, Gtk::Entry *>(sigc::mem_fun(*this, &Dialog::function), w2, w));
and changing the function body to this:
void Dialog::function(Gtk::Widget *w2, Gtk::Entry *w)
{
if((MyClass *) w)->get_boolean_val())
w2->do_something();
}
This works but I feel as if there is a better way to edit the 'w' object's boolean value and pull it. Similar to how the keyword 'this' works.
I'm new to C++