Re: Custom Widget and signals



On Thu, 2010-01-28 at 18:35 +0100, Carlo Ascani wrote:
> Hi all,
> 
> I have a custom widget (A) in cairomm that inherits from
> Gtk::EventBox, this widget have a signal and it works  fine.
> I have implemented a class (B) that inherits from a Gtk::VBox that has
> a Gtk::Label and an A instance.
> 
> I need to change the label text of B when the signal from A occours.
> How can i do it?
> 
> If i was not clear in language, maybe i could paste some real code to
> help you understand what i mean.
> 
> 
> Cheers

Probably in class B connect to signal emitted by class A, in which you
change a label. In rough pseudocode that would look like this:

class A
{
public:
  signal_something();
};

class B
{
  Label m_l;
  A m_a;
public:
  B();
  something_handler();
};

B::B()
{
  m_a.signal_something().connect(*this, &something_handler());
}

B::something_handler()
{
  m_l.set_text("blabla");
}



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