Re: [gtkmm] GTKMM classes handling local variables



Murray Cumming Comneon com wrote:

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


True, that it is basic c++, how silly of me, I think being forced to write software with .Net and C# has clouded my brain lol, this is the first C++ code I have written in about 4 or 5 months so it will be a couple more days until I am back in the loop again ;)

----
The only problem with being a proffesional developer (completely self taught!) is that I need to program in more languages than anyone else to stay at the top of my game and beat the boys with degrees in Computer Science, Math and Software Eng.




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