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 and modal child dialogs

modeless and modal child dialogs

Scheduled Pinned Locked Moved C / C++ / MFC
help
5 Posts 4 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.
  • 2 Offline
    2 Offline
    23_444
    wrote on last edited by
    #1

    I'm creating a modal child dialog and a modeless child dialog to learn about them. I have a simple SDI application that calls the dialogs. The modal child dialog derived from CDialog opens up behind the mainframe and does not have the focus, nor is it ever able to obtain the focus once I find it, i.e. title bar remains grayed and cannot click on any buttons on the modal child dialog. Properties of the dialog are child and visible. CModalChild cmd; cmd.DoModal(); The modeless child dialog opens up as it should but does not have the focus nor is it ever able to obtain the focus, i.e. the title bar remains greyed although the modeless child dialog is functional. if (!m_pModelessChildDialog) m_pModelessChildDialog= new CModelessChild; if (!::IsWindow(m_pModelessChildDialog->GetSafeHwnd())) m_pModelessChildDialog->Create(IDD_DIALOG6, this); m_pModelessChildDialog->ShowWindow(SW_SHOW); Hope someone can help me understand this. Thanks.

    Z N 2 Replies Last reply
    0
    • 2 23_444

      I'm creating a modal child dialog and a modeless child dialog to learn about them. I have a simple SDI application that calls the dialogs. The modal child dialog derived from CDialog opens up behind the mainframe and does not have the focus, nor is it ever able to obtain the focus once I find it, i.e. title bar remains grayed and cannot click on any buttons on the modal child dialog. Properties of the dialog are child and visible. CModalChild cmd; cmd.DoModal(); The modeless child dialog opens up as it should but does not have the focus nor is it ever able to obtain the focus, i.e. the title bar remains greyed although the modeless child dialog is functional. if (!m_pModelessChildDialog) m_pModelessChildDialog= new CModelessChild; if (!::IsWindow(m_pModelessChildDialog->GetSafeHwnd())) m_pModelessChildDialog->Create(IDD_DIALOG6, this); m_pModelessChildDialog->ShowWindow(SW_SHOW); Hope someone can help me understand this. Thanks.

      Z Offline
      Z Offline
      zon_cpp
      wrote on last edited by
      #2

      Hello. In the SDI project, you should show your dialogs after created the mainframe class. You should calling the DoModal or ShowWindow Founctions in the your view class. excuse me if my sentences are not complete. because, I don't know english well. Zo.Naderi_Iran

      2 1 Reply Last reply
      0
      • Z zon_cpp

        Hello. In the SDI project, you should show your dialogs after created the mainframe class. You should calling the DoModal or ShowWindow Founctions in the your view class. excuse me if my sentences are not complete. because, I don't know english well. Zo.Naderi_Iran

        2 Offline
        2 Offline
        23_444
        wrote on last edited by
        #3

        Thanks Zo. Yes both are being called from the Mainframe's view class but still the problems.

        1 Reply Last reply
        0
        • 2 23_444

          I'm creating a modal child dialog and a modeless child dialog to learn about them. I have a simple SDI application that calls the dialogs. The modal child dialog derived from CDialog opens up behind the mainframe and does not have the focus, nor is it ever able to obtain the focus once I find it, i.e. title bar remains grayed and cannot click on any buttons on the modal child dialog. Properties of the dialog are child and visible. CModalChild cmd; cmd.DoModal(); The modeless child dialog opens up as it should but does not have the focus nor is it ever able to obtain the focus, i.e. the title bar remains greyed although the modeless child dialog is functional. if (!m_pModelessChildDialog) m_pModelessChildDialog= new CModelessChild; if (!::IsWindow(m_pModelessChildDialog->GetSafeHwnd())) m_pModelessChildDialog->Create(IDD_DIALOG6, this); m_pModelessChildDialog->ShowWindow(SW_SHOW); Hope someone can help me understand this. Thanks.

          N Offline
          N Offline
          Neelesh K J Jain
          wrote on last edited by
          #4

          I think, even though u r calling DoModal() on modal dialog box, the main focus is present on the view and mainframe and the Menu is grayed may be because you may have attached the menu to the dialog box instead to the main window. Try attaching the menu to the main frame window. Work hard and bit of luck is KEY to SUCCESS.

          A 1 Reply Last reply
          0
          • N Neelesh K J Jain

            I think, even though u r calling DoModal() on modal dialog box, the main focus is present on the view and mainframe and the Menu is grayed may be because you may have attached the menu to the dialog box instead to the main window. Try attaching the menu to the main frame window. Work hard and bit of luck is KEY to SUCCESS.

            A Offline
            A Offline
            Anonymous
            wrote on last edited by
            #5

            Thanks, but no menus involved. Just the form view calling a modal child dialog via a button and the form view call a modeless child dialog via another button.

            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