[gtkmm] How to access Widgets generated by glademm, was Re: [glade--]Getting handles to Gtk Objects
- From: Christof Petig <christof petig-baender de>
- To: Douglas Roberts <dzzr lanl gov>
- Cc: glademm-list <glademm-list gnome org>, gtkmm-list <gtkmm-list gnome org>
- Subject: [gtkmm] How to access Widgets generated by glademm, was Re: [glade--]Getting handles to Gtk Objects
- Date: Mon, 15 Sep 2003 11:27:17 +0200
I cc this to gtkmm-list as well since this seems to be not widely known.
Douglas Roberts schrieb:
Hi.
I've been in discussion with the folks on the gtkmm list trying to find
out how to get handles to the gui objects created when you save an
application with glade-2/gtkmm as C++ code. I'll include a snippet from
one of the messages on that list to ask my question, as it nicely
summarized my problem:
Thanks,
--Doug
Sorry for answering this late (busy elsewhere), but as I said numerous
times in numerous places (and as newest (CVS) glademm versions tell you)
you will not be able to access the widgets unless you mark them as
either protected or public (private is the default which simply means
invisible to you!).
This optionmenu (visibility) is only available if you select C++ as the
language in glade.
Does this answer cover all the confusion seen on this list in the last
four weeks (my holiday)?
Christof
SNIP
-------
Yep, you've about got it summarized, with one minor twiddle: you can't
even get hold of pointers to the main windows where the other
object-wrapped widgets (like Gtk::button, Gtk::entry, etc., etc.)
reside, unless you edit the glademm-generated code to re scope them to
be global as well. Not an acceptable solution, because 1) global
scoping is bad here, and 2) those files get over-written each time you
save the GUI C++ code from glade.
sigh. Quoting the user guide:
Then think whether you need to access a widget in your program. If
you need to access it (e.g. read or alter values) inside your scope
(class) declare it as protected. (Attaching signals to widget does not
count as a need to access it)
Quoting the download page:
The <b>number one problem</b> seems to be that people forget to mark
widgets they want to access as <b>protected or public</b>.
Thus you're left with glademm, and if that doesn't provide you with
access to the widgets in the window you've got a problem - and to be
honest, I think it probably should have a way to do that, and it may
already have one; although judging by the code snippet in one of your
e-mails it's not looking particularly hopeful.
Feature enhancements to glademm should be discussed on the glademm list
of course.
any real enhancements left?
Christof
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]