Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / close the frame from the panel

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. close the frame from the panel
#4425
Posted by: 2004-06-11 17:42:21
Hi,

I have a general problem with access on my objects. the situation: I have one mail frame (one class) with panel (Another class), from the button of this panel I cool another help-frame ( (a new class) the first staes visible). In this second frame I have inside a panel of type Another. Now I'like to close this help-frame from botton on the panel. the problem - runtime error.

class Adresse: public wxFrame{
public:
   Adresse(const wxString& title, const wxPoint& pos, const wxSize& size);
   Adresse::~Adresse(){}
};

class MyPanel: public wxPanel{
public:
   MyPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size);
   MyPanel::~MyPanel(){}
   void OnAdressePers(wxCommandEvent& event); // to cool the help    frame:adresse
   void OnQuitUF(wxCommandEvent& event);
protected:
         Adresse *frameAdr;
........

void MyPanel::OnAdressePers(wxCommandEvent& WXUNUSED(event)){
   frameAdr = new Adresse("KATALOG Adresse", wxPoint(250, 150), wxSize(500, 500));
   frameAdr->Show(TRUE);
}

void MyPanel::OnQuitUF(wxCommandEvent& WXUNUSED(event)){
      frameAdr->Close(TRUE);    // runtime error   
}

thanks!
Message2. Re: close the frame from the panel
#4426
Posted by: upCASE 2004-06-11 20:06:27
Hi!
Have you tried catching the button event in the frame? If you set  the panel as parent for the button and the frame as parent for the panel, the event should propagate through the panel to the frame. Then, close the frame...
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥1,420.00 ·
 
 
¥950.00 ·
 
 
¥288.00 ·
 
 
¥738.00 ·
 
 
¥397.00 ·
 
 
¥750.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0