Re: [glade--]Yet the same question

Christof Petig <[email protected]> Wed, 04 Feb 2004 10:32:02 +0100
Newsgroups gmane.comp.gnome.glademm
Organization Adolf Petig GmbH & Co. KG
Message-ID <[email protected]>
Tadas Dailyda schrieb:
> Let's say I have to windows: window1 and window2. These windows have
> there visibility property set to public. I have a button in first
> window. So how should I refer to window2 from button's callback
> function. 

Usually I pass a pointer to different widget trees to a widget's ctor 
and save it in a member variable if I need to access widgets in a 
different tree (window).

E.g.
    #include <window2.hh>
    class window1 : public window1_glade
    {  window2 *w2;
     public:
       window1(window2 *x) : w2(x) { ... }
    };

--

 > And how could I refer to button in window2 leaving it's
 > visibility private.

you cannot ever access a private widget. Raise it to protected to access 
it in it's own class and to public to access it from outside (or pass 
the pointer by a public function).

Hope this helps
   Christof