[glade--]Rearragement of code (dialog's widgets as members)



I have thought about this before, but now I'll ask what others think.

The way glademm currently writes code, all of your widgets for a dialog
are limited in scope to the myDialog_glade constructor.  To do anything
with your dialog becomes a task of rearranging where widgets are at in
scope.  Usually this (at least so far for me) means inside the
myDialog_glade constructor, changing this:

Gtk::RadioButton *myRB = manage(new class
Gtk::RadioButton(_RadioBGroup_myRB, "_One Radio Button", true));

To:

myRB = manage(new class Gtk::RadioButton(_RadioBGroup_myRB, "_One Radio
Button", true));

Of course, you first have to make "Gtk::RadioButton *myRB" a class
member before doing the above.  By doing this you will have access to it
in your derived class (myDialog), and can work with it in your signal
handling functions (maybe on your OK button on your dialog, you want the
signal handler to read parts of the dialog, maybe some text fields or
something like that).

How many others are doing it this way?  If there is a lot, perhaps
glademm should start declaring widgets in a dialog as class members, and
then inside the _glade constructor for the dialog, just assign to them
(as shown above) rather than declaring them and therefore limiting their
scope only to the constructor.

Is there a much simpler way to work with the current code format that I
am just not seeing?

-- 
Mark Jones <mark jones106 verizon net>




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