Re: [gtkmm] beginner´s question
- From: Roger Leigh <roger whinlatter uklinux net>
- To: "Andreas B. Thun" <abt gmx de>
- Cc: gtkmm-list gnome org
- Subject: Re: [gtkmm] =?utf-8?b?YmVnaW5uZXLCtHMgcXVlcw==?==?utf-8?b?dGlvbg==?=
- Date: Sat, 27 Dec 2003 22:27:29 +0000
"Andreas B. Thun" <abt gmx de> writes:
> I have a class ConstraintGui with a private member
> m_TreeBrowserBox.
> The constructor of a friend class ConstraintTypesBrowser
> creates a TreeBrowserBox I want to assign to m_TreeBrowserBox.
>
> I am doing something wrong there, because
> guiRef.m_TreeBrowserBox.pack_start(myTreeBrowserBox);
> will not compile:
> Gtk::VBox& Gtk::VBox::operator=(const Gtk::VBox&)' discards qualifiers
What are "guiRef" and "m_TreeBrowerBox"?
I don't see them defined within the constructor, or passed as
arguments. If you identify what these are, and why exactly you need
them, you'll find the cause of your problems, I think.
As for the error itself: you are assigning a "const Gtk::VBox&" to a
"Gtk::VBox". The assignment discards the "const" qualifier. I've
never *ever* needed to assign widgets directly either with C/GTK+ or
C++/Gtkmm. Perhaps you should be using a pointer instead??
> class ConstraintGui : public Gtk::Window {
>
> public:
> ConstraintGui();
> virtual ~ConstraintGui();
>
> friend class ConstraintTypesBrowser;
>
> private:
> Gtk::VBox m_TreeBrowserBox;
>
> }; // class
OK. (Do you really need a friend, or could you achieve the same
effect through member functions?)
> ConstraintTypesBrowser::ConstraintTypesBrowser(
> const ConstraintGui &constraintGuiRef
> :
> m_Frame("my frame:")
> {
> ...
>
> // Created a box I want to assign to m_TreeBrowserBox
>
> // How can I assing myTreeBrowserBox to m_TreeBrowserBox?
> // I am a friend class so I should have access to the
> // private member m_TreeBrowserBox of class ConstraintGui
> guiRef.m_TreeBrowserBox.pack_start(myTreeBrowserBox); // will not compile
> }
This is incomplete (and not compilable).
HTH,
Roger
--
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]