Re: [gtkmm] lookup_widget in glademm
- From: Christof Petig <christof petig-baender de>
- To: Igor Gorbounov <igorbounov voronezh serw ru>
- Cc: Silviu D Minut <minutsil cse msu edu>, gtkmm-list gnome org
- Subject: Re: [gtkmm] lookup_widget in glademm
- Date: Fri, 16 May 2003 11:25:11 +0200
Igor Gorbounov wrote:
Silviu D Minut wrote:
In building GUIs with glade in C there was this lookup_widget() function
that did the obvious, defined in support.c. In glade-2 with glade-- there
is a window1_glade.hh which defines the main window of the application
(derived from Window). All the widgets contained in the main window
are pointers - only defined locally in the constructor, hence not visible
outside the constructor (e.g. in a callback). Is there a loolup_widget()
analog for glade-- ?
You should declare widgets as "public" in glade, then they will be
accessible by name without lookup_widget(). You can add new
(your own) methods and properties using produced by glade
classes as base classes and changing them by inheritance.
Right. Very good explanation.
Since this is far more flexible, far more secure and far more
transparent I dropped support for the GMM_* macros and the lookup_widget
function which were present in previous versions.
Try this if you really need global variables (seldom):
class Win;
extern Win *winptr;
class Win : public Win_glade
{public:
Win() { winptr=this; }
~Win() { winptr=0; }
};
anywhere else:
winptr->a_public_widget->show();
- or modify main() to store the pointer in a global variable.
Of course any contained widget marked as public is accessible by other
methods/functions then (see above)
Christof
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]