Modeless Windows
-
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.
-
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.
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