What is the right way to close a frame in wxWidgets Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
sly_chandan
Earned some good credits
Earned some good credits
Posts: 116
Joined: Fri Sep 25, 2015 2:33 pm

Re: What is the right way to close a frame in wxWidgets

Post by sly_chandan »

I have tried everything now buddy.

But nothing works. What do you suggest I should do?
sly_chandan
Earned some good credits
Earned some good credits
Posts: 116
Joined: Fri Sep 25, 2015 2:33 pm

Re: What is the right way to close a frame in wxWidgets

Post by sly_chandan »

Can I mail you the code?

Would you be able to test it from your end?
sly_chandan
Earned some good credits
Earned some good credits
Posts: 116
Joined: Fri Sep 25, 2015 2:33 pm

Re: What is the right way to close a frame in wxWidgets

Post by sly_chandan »

Can I mail you the code?
sly_chandan
Earned some good credits
Earned some good credits
Posts: 116
Joined: Fri Sep 25, 2015 2:33 pm

Re: What is the right way to close a frame in wxWidgets

Post by sly_chandan »

Hurray!

I solved the bug..

I just had to do a run around to my problem.

All I had to do was hide the Frame with this->Show(false);

Even that works like a charm!

Thanks bro!
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: What is the right way to close a frame in wxWidgets

Post by doublemax »

All I had to do was hide the Frame with this->Show(false);
That's not the same. The frame will still exist until you close the application.
Use the source, Luke!
sly_chandan
Earned some good credits
Earned some good credits
Posts: 116
Joined: Fri Sep 25, 2015 2:33 pm

Re: What is the right way to close a frame in wxWidgets

Post by sly_chandan »

Will I face any memory leaks or something like that?
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: What is the right way to close a frame in wxWidgets

Post by doublemax »

sly_chandan wrote: Thu Feb 18, 2021 1:54 pm Will I face any memory leaks or something like that?
Not really, because all toplevel windows will be destroyed automatically when the application terminates. But if your app runs a long time, and the user creates that type for frame often, the used memory and GDI handles will accumulate over time. It's definitely not a good situation.
Use the source, Luke!
sly_chandan
Earned some good credits
Earned some good credits
Posts: 116
Joined: Fri Sep 25, 2015 2:33 pm

Re: What is the right way to close a frame in wxWidgets

Post by sly_chandan »

I have now done a re-installation of the wxWidgets and created a Fresh New Project.

I still am facing the issue.

What could be the problem? I think its the number of Controls that are contained in the Frames.

The Short Frame works fine.

But when the other 2 Bigger Frames just wont Close.

Please help......
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: What is the right way to close a frame in wxWidgets

Post by ONEEYEMAN »

Hi,
Please create minimal reproducible test case and attach it here.
Also - why do you insist on using wxFrame instead of wxDialog?

Thank you.
sly_chandan
Earned some good credits
Earned some good credits
Posts: 116
Joined: Fri Sep 25, 2015 2:33 pm

Re: What is the right way to close a frame in wxWidgets

Post by sly_chandan »

I have created a minimal project.

Try closing the Create Contact Window after frame created.


I want an independent modeless window for creating Contacts.
Attachments
TestingShellForClose.rar
attached the minimal project
(426.71 KiB) Downloaded 93 times
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: What is the right way to close a frame in wxWidgets

Post by doublemax »

This sample works fine for me. So it must be something related to your build.

Which wxWidgets version are you using?
Use the source, Luke!
sly_chandan
Earned some good credits
Earned some good credits
Posts: 116
Joined: Fri Sep 25, 2015 2:33 pm

Re: What is the right way to close a frame in wxWidgets

Post by sly_chandan »

Are you sure that the application is not crashing?

When I close the contact window the application crashes.


I am using wxWidgets-3.1.4
wxMSW-3.1.4_gcc920TDM_Dev
wxWidgets-3.1.4-headers
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: What is the right way to close a frame in wxWidgets

Post by doublemax »

sly_chandan wrote: Thu Feb 18, 2021 6:36 pm Are you sure that the application is not crashing?
Yes :)

Here's the exe i created if you want to try it yourself. (Built with VS2017)
https://www.sendspace.com/file/tn84f6
sly_chandan wrote: Thu Feb 18, 2021 6:36 pm I am using wxWidgets-3.1.4
wxMSW-3.1.4_gcc920TDM_Dev
wxWidgets-3.1.4-headers
Are you using the exact same compiler as the prebuilt binaries?

If you can't find the error, i suggest to build the wxWidgets libraries yourself. That's the best way make to make sure they match your own code.
Use the source, Luke!
sly_chandan
Earned some good credits
Earned some good credits
Posts: 116
Joined: Fri Sep 25, 2015 2:33 pm

Re: What is the right way to close a frame in wxWidgets

Post by sly_chandan »

The compilation seems fine. The sample applications run fine and also the shell application for wxwidgets works great.

It is just that my particular frame wont close.

what are the suggested binaries I need to use?


I am using the gcc (tdm64-1) 9.2.0
wxMSW-3.1.4_gcc920TDM_Dev
wxWidgets-3.1.4-headers

compilation command for wxWidgets is:

mingw32-make -j8 -f makefile.gcc BUILD=debug SHARED=1 UNICODE=1 VENDOR=custom MONOLITHIC=1
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: What is the right way to close a frame in wxWidgets

Post by doublemax »

wxMSW-3.1.4_gcc920TDM_Dev
wxWidgets-3.1.4-headers
This indicates you were using the prebuilt libs.
mingw32-make -j8 -f makefile.gcc BUILD=debug SHARED=1 UNICODE=1 VENDOR=custom MONOLITHIC=1
This says you built wxWidgets yourself.

Which one is it?

Are you sure you're not including wx headers or libs from another wx version into your app?
Use the source, Luke!
Post Reply