Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / When do delete wxObjects?

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. When do delete wxObjects?
#2484
Posted by: lea 2003-08-20 17:32:26
Hi!

I am new here and to wxWindows.
My first question is when to delete wxXXX-Object (like wxButton, etc.) i created with new.
Or takes the close()-methode of the wxFrame care of this?

thx
Message2. Re: When do delete wxObjects?
#2486
Posted by: guidance 2003-08-20 18:44:09
Yes, this is called "managed window". For each control with parent argument in its constructor, you needn't delete it, in my understanding.
May check the "controls" sample at samples directory for learning.
Message3. Re: When do delete wxObjects?
#2491
Posted by: 2003-08-21 01:23:32
In addition to what Guidance said I'd give you the advice not bother too much about deleting objects. Try to go without it as long as you can. I experienced some very nasty crashes once while writing an app and all debugging didn't really help. Afterwards I found out that it only came from an object I deleted and wx was trying to delete it again.

Normally wx takes care of created objects by itself. Only on rare occasions you may want/have to delete objects explicitly.

upcase
Message4. Re: When do delete wxObjects?
#2497
Posted by: guidance 2003-08-21 07:43:27
> Afterwards I found out that it only came from an object I
> deleted and wx was trying to delete it again.

What're these objects for instance?
I understand only these controls have "parent" argument will be deleted by wxWindows automatically, other objects not.
Message5. Re: When do delete wxObjects?
#2511
Posted by: 2003-08-22 00:09:51
I don't remember exactly what it was, but I think it had something to do with menu items that had to be deleted in order to support internationalisation...

upcase
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2023-1-27  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0