Results 1 to 7 of 7

Thread: [wxPython/wxWidegts] AboutDialogInfo & Modal

Threaded View

  1. #1
    Join Date
    May 2008
    Beans
    1,029

    Question [wxPython/wxWidegts] AboutDialogInfo/AboutBox Isn't Modal

    Is there a way to make an AboutDialogInfo/AboutBox window modal? I haven't been able to find it anywhere in the wxPyDocs or wx docs. Currently, when the AboutBox is open, I can still interact with the main window and open as many about boxes as I want, which doesn't seem like it should be the default behavior.

    Here is some sample Python code:
    PHP Code:
    import wx

    class MainWindow(wx.Frame):
        
    def __init__(selfparentidtitle):
            
    wx.Frame.__init__(selfparentidtitle)
            
            
    self.bg wx.Panel(self, -1)
            
            
    about_button wx.Button(self.bg, -1"About")
            
            
    wx.EVT_BUTTON(about_button, -1self.ShowAbout)
            
            
    self.about wx.AboutDialogInfo()
            
        
    def ShowAbout(selfevent):
            
    wx.AboutBox(self.about)

    class 
    MyApp(wx.App):
        
    def OnInit(self):
            
    frame MainWindow(None, -1"Test")
            
    frame.Show()
            
    self.SetTopWindow(frame)
            return 
    True

    app 
    MyApp(0)
    app.MainLoop() 
    and sample C++ code:
    PHP Code:
    #include <wx/wx.h>
    #include <wx/aboutdlg.h>

    class MainWindow : public wxFrame
    {
      public:
        
    MainWindow(const wxStringtitle);
        
    void ShowAbout(wxCommandEventevent);
      private:
        
    wxAboutDialogInfo about;
    };

    MainWindow::MainWindow(const wxStringtitle) : wxFrame(NULL, -1title)
    {
        
    wxPanel *bg = new wxPanel(this);

        
    wxButton *about_button = new wxButton(bg, -1_T("About"));

        
    about_button->Connect(wxEVT_COMMAND_BUTTON_CLICKEDwxCommandEventHandler(MainWindow::ShowAbout), 0this);
    }

    void MainWindow::ShowAbout(wxCommandEventevent)
    {
        
    wxAboutBox(about);
    }


    class 
    MyApp : public wxApp
    {
      public:
        
    virtual bool OnInit();
    };

    IMPLEMENT_APP(MyApp)

    bool MyApp::OnInit()
    {
        
    MainWindow *frame = new MainWindow(_T("test"));
        
    frame->Show();
        
    SetTopWindow(frame);
        return 
    true;

    Last edited by dodle; August 23rd, 2010 at 08:45 AM. Reason: Add C++ code

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •