Modal window

wxD
Rommi
2009-02-04
2013-05-22
  • Rommi

    Rommi - 2009-02-04

    How do I make a modal window? For example when I open a settings window of my application.

     
    • Rommi

      Rommi - 2009-02-08

      I found a commented method wxWindow_MakeModal. I decommented it and added appropriate call to Window class. Works fine (atleast under Windows, Linux test will follow). Why was it commented out?

       
      • Anders F Björklund

        No idea actually, adding it now...

         
    • Rommi

      Rommi - 2009-02-08

      To continue discussion with myself...

      The best way to make window modal, is make it modal on Event.wxEVT_SHOW. Otherwise it will behave strange with a focus of it's parent window.

      This example works without focus loss:

      class SettingsWindow : Frame {
          this()
          {
              AddEventListener(Event.wxEVT_SHOW, &onShow);
          }
          void onShow(Object sender, Event e)
          {
              if (IsShown()) {
                  MakeModal(true);
              } else {
                  MakeModal(false);
              }
          }
      }

      onShow method will be called automatically on both - hide and show actions.

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks