Re: [gtkmm] libglademm



Quick reply! Thanks a lot!

Murray Cumming Comneon com wrote:
From: Christer Palm [mailto:palm nogui se] I've taken the route of creating my own Gtk::Window objects with a constructor that looks up the guts of the corresponding window in the Glade::Xml and reparents it to itself.


I've done this in the past, but I believe the get_widget_derived() method in
libglademm 2.1.0 is the new one-true-way.


OK, I haven't looked at 2.1.0 yet that but it sounds interesting. I'll check it out.


libglademm will give useful warnings at compile time, so I tend to avoid the
null pointer checks. Nothing is going to work if someone has messed up the
.glade file. Anyway, an if() is just one line.


Hmm. I guess you mean it gives you a warning at _runtime_? Indeed it does. However, IMHO, it is bad programming practice to avoid checking pointers just beacuse they "shouldn't" be null. Also, a missing widget is not necessarily fatal to the app. I even found it quite useful to have this gracefully handled when "fine-tuning" the design in glade.

However, I suppose all that is a matter of taste and programming style which, although very interesting, could probably be discussed forever :-)

There's the if(), But I also need to declare a temp variable to hold the widget pointer, initialize it, and the signal assignment goes inside the if() instead of in the get_widget() expression, so there will be a few lines of code. Ideally, I want a mechanism that could encapsulate that into a single call. Conceptually, that's the same as the VariablesMap.


I got quite disappointed to find out that Glade::VariablesMap, by design, only works with entry boxes and checkbuttons


What else would you like to use it with?


In my settings dialog where I try to use it, I also have OptionMenus and TreeViews (although I guess the TreeView might be a bit much to ask for). I guess Scales could be useful too.

I suppose I could treat the individual MenuItems of an OptionMenu as ToggleButtons, but in this case the choices are mostly built dynamically.

--
Christer Palm




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