I have created several modal dialogs which usually include a Cancel button to which I attach an onclick event. Inside the event I usually put:
Code: Select all
However this appears to cause the dialogs to close not only themselves, but also the window they were activated from. Running debug I have found using Destroy() has caused an access violation and everything is being closed.
So I have got rid of the event, and set the button ID to wxID_CANCEL. Now my dialog closes as it should. (I also note that using wxID_CLOSE does not close the dialog.)
I understand that the best way to reclaim memory is to use Destroy(), so I have put it into the dialog destructor. It doesn't appear to cause any bad consequences, but is it a valid use of Destroy()?
If anyone could shed any light on the problem, or fill in some gaps in my understanding, it would be appreciated.