THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/01/2007 at 03:42, xxxxxxxx wrote:
MyDialog md; //Memory allocation on stack
md.open(); //Open the dialog, CreateLayout is called automatically
this is what you should do. You must create the dialog first. When you call anything from an empty pointer then it will crash for sure. Anyway, I don´t know what you want to do, but I would rather use a member pointer in your class, and then call
md = gNew MyDialog();
instead, otherwise the dialog will be freed when it leaves the message function, which is not what I think you intent. With the heap allocation you have to delete the dialog anywhere yourself then!
The last and best solution is that you use
directly as a member of your class, then you don´t have to think about it. It will be destroyed when your object gets destroyed.
CreateLayout() will be called automatically when you call open. You shouldn´t call it directly (if it isn´t necessary). Everything needs memory. :)