close query from MDIChildFrame
Rory Walsh
rorywalsh at ear.ie
Mon Oct 16 15:17:59 PDT 2006
Sorry it's taken so long to get back to you. You suggestion seems to
make perfect sense but I don't know how to set up an event table for my
child frame. In my code I have a vector of type MDIChildFrame. Each time
I hit a menu command 'new Child' I resize the vector and dynamically
create a new child frame. Can I dynamically create an event table, using
the Connect() method? I've tried that, albeit wrongly. Here is the
handler that is called whenever the users hits the new child menu command
void wxLooperFrame::newChild(wxCommandEvent& event)
{
loopStation.resize(loopCnt+1);
loopStation[loopCnt] = new wxMDIChildFrame(this, -1, "New Child",
wxDefaultPosition, wxSize(215, 255), wxDEFAULT_FRAME_STYLE);
loopStation[loopCnt]->Connect(ID_MENU_QUIT,
wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&wxLooperFrame::OnQuit);
loopCnt++;
}
wxLooperFrame is my main frame class and it is derived from a
wxMDIParentFrame. My main class has an OnQuit event handler that I would
like to plug my child frame into so my childframes will call
wxLooperFrame::OnQuit when someone attempts to close them. Is it not
working because of the fact I am passing the wxEVT_COMMAND_MENU_SELECTED
type? Any help is much appreciated.
Rory.
Vadim Zeitlin wrote:
> On Thu, 12 Oct 2006 11:20:36 +0100 Rory Walsh <rorywalsh at ear.ie> wrote:
>
> RW> How can I find out if an MDIChildFrame has had it's 'X'(Close) button
> RW> pressed? I seem to be able to add an event to my main application to
> RW> notify me of a close but I can't seem to figure out how to do it with an
> RW> MDIChildFrame?
>
> EVT_CLOSE() in the event table for the child frame should work AFAIK.
>
> Regards,
> VZ
>
More information about the wx-users
mailing list