Search found 347 matches

by Dark Alchemist
Fri Jul 30, 2010 7:39 pm
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

Well, I started the process of thinking about all of this and examined all of this. I decided I might be looking in the obvious place when it might actually be in the non obvious dialog. Well, I reused my standard dialogs which demands ->ShowModal instead of the .ShowModal of my private class versio...
by Dark Alchemist
Fri Jul 30, 2010 6:50 pm
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

Well, I disconnected every event associated with it and still a crash so I removed the setshape (shaped flag set to false too) but still a crash so I removed the setshape as well as the events and still a crash on that show(false).
by Dark Alchemist
Fri Jul 30, 2010 6:07 pm
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

I tested this with one of my older projects that uses a wxFrame as main window and a wxDialog that's shown on demand. It works fine to Hide() & Show() the wxFrame. If hiding a wxFrame would destroy it, it would definitely be a bug. I think the reason for your crash lies somewhere else. Well, could ...
by Dark Alchemist
Fri Jul 30, 2010 5:41 pm
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

I found where it is deleting and it is this line: this->Show(false); Ok good. Seems like my initial theory that the frame is self-destructing when hidden is confirmed. Making a dialog that has a deleted frame as parent is explosive, trying to re-show the deleted frame too. However I have no idea ho...
by Dark Alchemist
Fri Jul 30, 2010 4:32 pm
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

This error tells you that a delete was called on an invalid pointer. Now you have to find out what that invalid pointer was and why it happened. Open the Callstack window and click on the first code line that's in your code. In the variables window you can see the value of all variables at that poi...
by Dark Alchemist
Fri Jul 30, 2010 5:39 am
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

Just thought I would add that the issue I was having with the debugger really was due to wxDevcpp. So, I went into MSVC where I have not used its debugger since VS6/2003 and man is it ever nice. I now know it crashes on the show line 100% (already knew but the debugger showed me) but can you tell me...
by Dark Alchemist
Fri Jul 30, 2010 2:20 am
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

Yes, you should really learn how to use a debugger ;) Apart from that, another wild guess: Maybe the dialog doesn't like to have a hidden parent. Try NULL as parent for the dialog. And btw, from a gui point of view it's very unusual to hide the main window when you open a modal dialog. I agree on a...
by Dark Alchemist
Fri Jul 30, 2010 2:20 am
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

Yes, you should really learn how to use a debugger ;) Apart from that, another wild guess: Maybe the dialog doesn't like to have a hidden parent. Try NULL as parent for the dialog. And btw, from a gui point of view it's very unusual to hide the main window when you open a modal dialog. I agree on a...
by Dark Alchemist
Fri Jul 30, 2010 2:08 am
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

Well, this is where I have a huge disadvantage because I just don't know how to do a viable trace. I use wxdevcpp (gcc) for the main trial and error but what do I do?

Would love to learn this part because honestly I just never needed to debug until now.
by Dark Alchemist
Fri Jul 30, 2010 1:26 am
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

I hate doing it like this but I have no choice since I can't trace what is happening. MyDlg TempDlg(this); int x,y; this->GetScreenPosition(&x,&y); this->Move(32000,32000); TempDlg.ShowModal(); this->Move(x,y); Makes me feel bad doing something like that. Oh, it works but ugh. One thing I just tried...
by Dark Alchemist
Fri Jul 30, 2010 1:08 am
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

Can you provide a minimal compilable sample showing the problem? Meanwhile, here's my idea : when a wxWidgets frame is closed, the default behavior is to self-destruct. Self-destruction is however not done right now but queued to be done later when the event queue is empty to avoid crashes when eve...
by Dark Alchemist
Thu Jul 29, 2010 9:41 pm
Forum: C++ Development
Topic: How to properly hide then unhide the main toplevel window?
Replies: 37
Views: 9725

How to properly hide then unhide the main toplevel window?

this->Show(false); TempDlg.ShowModal(); this->Show(true); When I remove the modal (dialog) the above code works and my main frame is hidden then reshown but if I allow the modal to open and it returns my program crashes. Everything works fine if I remove the show commands so I am wondering what is ...
by Dark Alchemist
Thu Jul 29, 2010 4:54 pm
Forum: C++ Development
Topic: button event queue question and help needed.
Replies: 9
Views: 1500

The above that I described worked perfectly. What I did was set the bitmap label to the same as SetBitmapSelected then set my flag and off I went. Now you may click the button as many times as you wish and it looks like nothing is happening but in reality it is triggering the event just not acting o...
by Dark Alchemist
Thu Jul 29, 2010 4:29 pm
Forum: C++ Development
Topic: button event queue question and help needed.
Replies: 9
Views: 1500

Agreed with doublemax, blocking the GUI is the wrong approach (because the OS may queue event, as I explained earlier); I would instead recommend running the long calculation in a thread. Then clicking on the button disables it, starts the thread; when the thread is done, it sends and event to the ...
by Dark Alchemist
Thu Jul 29, 2010 4:19 pm
Forum: C++ Development
Topic: button event queue question and help needed.
Replies: 9
Views: 1500

The behavior is not really surprising, because the events that occur during your longer calculation are only dispatched after you have connected the event handlers already. So you need a flag to prevent reentrancy and a wxYield() before enabling the button again, so that the pending events are clea...