Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Modeless Windows

Modeless Windows

Scheduled Pinned Locked Moved C / C++ / MFC
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jay Hova
    wrote on last edited by
    #1

    Hi, I still can not figure this out, was wondering if anyone had suggestions. I have a modeless window and a modal window, each having their own window option that when selected bring up the corresonding window. The modal window has radio buttons on it, so when a specific reaio button is selected and ok is entered, it will display the modless window. When I select the menu to bring up the modeless window it works fine, only opens one window or sets focus to it if it has not been created. When I select the modal window and check the appropriate radio it will display the modeless window regardless if it is created already. It will just continue to duplicate the modeless window. Can someone help me out so that it will set focus on the open window and not diplicate it. currently I am using this code in the OnOK method.

    if (!m_pCommandOpt)// == NULL)
    {
         m_pCommandOpt = new CMainCommand(this);
    
         if (m_pCommandOpt->Create(IDD_MAIN_TAB_DIALOG) == TRUE)
         {
               GetDlgItem(IDOK)->EnableWindow(FALSE);
    	   m_pCommandOpt->ShowWindow(SW_SHOW);
         }
    }
          else
    	m_pCommandOpt->SetActiveWindow();>
    

    THANKS in advance.

    G 1 Reply Last reply
    0
    • J Jay Hova

      Hi, I still can not figure this out, was wondering if anyone had suggestions. I have a modeless window and a modal window, each having their own window option that when selected bring up the corresonding window. The modal window has radio buttons on it, so when a specific reaio button is selected and ok is entered, it will display the modless window. When I select the menu to bring up the modeless window it works fine, only opens one window or sets focus to it if it has not been created. When I select the modal window and check the appropriate radio it will display the modeless window regardless if it is created already. It will just continue to duplicate the modeless window. Can someone help me out so that it will set focus on the open window and not diplicate it. currently I am using this code in the OnOK method.

      if (!m_pCommandOpt)// == NULL)
      {
           m_pCommandOpt = new CMainCommand(this);
      
           if (m_pCommandOpt->Create(IDD_MAIN_TAB_DIALOG) == TRUE)
           {
                 GetDlgItem(IDOK)->EnableWindow(FALSE);
      	   m_pCommandOpt->ShowWindow(SW_SHOW);
           }
      }
            else
      	m_pCommandOpt->SetActiveWindow();>
      

      THANKS in advance.

      G Offline
      G Offline
      G Steudtel
      wrote on last edited by
      #2

      Hi, I have no idea, whar the clas CMainCommand is about, but nevertheless your code must fail. You create a new insatance of this class in OnOk() so this new instance surely doesnot know anything of windows/dialogs/form created prior to its creation. Thus Create(IDD_...) will always return true, because in the class instance of CMainCommand no flag or so is set to indicate that this dialog has been created already. Two possible solution. Try to get the applications pointer of its CMainCommand instance, and use this pointer. Or send/post the command to the application as if the user has selected the dialog via the menu. Regards G.Steudtel

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups