RE: [gtkmm] GTKMM classes handling local variables



> Thanks 
> for the advice, I think I will give 
> GTK::Manage a try, I think it 
> will take a little getting used to, usually 90% of my c++ 
> code is based 
> around pointers, even my old GTK stuff (I used to wrap GTK into C++ 
> before I discovered GTKMM). I would have thought the GTKMM team would 
> have catered for the use of local varibles in some way,

This is basic C++ - you might read about "scope" in a C++ book.

You might be used to using pointers instead, but you can use pointers here
as well, as people have pointed out. As with Qt, when you use pointers you
need to use new() or some create() function to get the pointer value. And
you need to either a) use delete some time later, or b) use some
memory-management system such as manage() or Qt's implicit manage(). So
there is nothing unusual or wrong about this. I think you are
mis-remembering your previous experience.

Maybe you think that the gtkmm method should copy your local Label instance,
by value, just as it would copy a std::string local instance. But
Gtk::Widgets can not be copied, and it probably would not make sense to do
so. See the archive for more theory about that, but you would probably not
find that interesting.

You might find this useful:
http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch18.html

> hence 
> my obvious 
> mistake of just trying to use them, I do however love the way 
> GTKMM does 
> a lot of things better than QT, oh well, right thanks again for the 
> advice, I should now be able to continue my projects (Gnome 
> Easy CD -- 
> website and source tree coming soonish, Groupmage - native 
> linux client 
> for Groupwise -- even though I use sun JDS, Fedora and Debian lol, -- 
> GnomeEasyInstall and GnomeAutoCD) hmm :-D

Murray Cumming
www.murrayc.com
murrayc usa net



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