wxMDIChildFrame - CloseEvent

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.
Post Reply
Shalafi
Earned a small fee
Earned a small fee
Posts: 10
Joined: Tue Dec 10, 2013 7:06 pm

wxMDIChildFrame - CloseEvent

Post by Shalafi » Fri Dec 27, 2013 5:29 pm

Hi,

i use a wxMDIParentFrame und some wxMDIChildFrame in my application.

How can i call a function, when a wxMDIChildFrame is closed?
I tryed

Code: Select all

BEGIN_EVENT_TABLE(Frames::Childwindow, wxMDIChildFrame)
	EVT_CLOSE(Frames::Childwindow::OnClose)
END_EVENT_TABLE()

[...]

void Frames::Childwindow::OnClose(wxCloseEvent &event)
{
	event.Skip();
}
but the code isn't executed.

What can i do?


BB

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2473
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxMDIChildFrame - CloseEvent

Post by PB » Fri Dec 27, 2013 7:16 pm

As you didn't state your platform... Does it work as expected in MDI sample bundled with wxWidgets where AFAICS it is done pretty much the same way as in the code you posted? It certainly does for me on Windows with wxWidgets 3.01.

Shalafi
Earned a small fee
Earned a small fee
Posts: 10
Joined: Tue Dec 10, 2013 7:06 pm

Re: wxMDIChildFrame - CloseEvent

Post by Shalafi » Sun Dec 29, 2013 3:49 pm

Hi,

Sry, the plattform is Windows.

It seems to me, that the close-event is only triggered, if a frame is closed, not if the application is exited.

How can i execute code, if a frame or panel is destoryed?
I have a panel, where directx is rendered. I need to release the directx, if the panal is destoryed.
But the EVT_CLOSE seems not to be triggered.


BB

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2473
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxMDIChildFrame - CloseEvent

Post by PB » Sun Dec 29, 2013 10:08 pm

Perhaps you could do it in the similar way it is implemented in the MDI sample and handle stuff from the wxMDIParentFrame's EVT_CLOSE handler...

Shalafi
Earned a small fee
Earned a small fee
Posts: 10
Joined: Tue Dec 10, 2013 7:06 pm

Re: wxMDIChildFrame - CloseEvent

Post by Shalafi » Mon Dec 30, 2013 9:35 am

Hi,

yes i tried to do it the similay way like the MDI Sample.
But in my application, the EVT_CLOSE is not triggered.

I uploaded my entire project, maybe someone find the error.


BB

Post Reply