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. Modal Dialogs

Modal Dialogs

Scheduled Pinned Locked Moved C / C++ / MFC
questionannouncement
6 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.
  • W Offline
    W Offline
    Waldermort
    wrote on last edited by
    #1

    I have created a custom control which, upon a mouse click, should display a dialog showing some info about what was clicked. I need this dialog to have a semi-modal style. IE I want the user to be able to click the custom control and have the dialog update it's display, but not allow the user to click outside of the control unless the dialog is first closed. How could I achieve this?

    Waldermort

    N 1 Reply Last reply
    0
    • W Waldermort

      I have created a custom control which, upon a mouse click, should display a dialog showing some info about what was clicked. I need this dialog to have a semi-modal style. IE I want the user to be able to click the custom control and have the dialog update it's display, but not allow the user to click outside of the control unless the dialog is first closed. How could I achieve this?

      Waldermort

      N Offline
      N Offline
      Nishad S
      wrote on last edited by
      #2

      If you are creating the window modeless using Create and disabling all the controls except the special controls, I think it is possible... Or could you please explain a little more?

      - NS -

      W 1 Reply Last reply
      0
      • N Nishad S

        If you are creating the window modeless using Create and disabling all the controls except the special controls, I think it is possible... Or could you please explain a little more?

        - NS -

        W Offline
        W Offline
        Waldermort
        wrote on last edited by
        #3

        Disabling controls of the parent window from within a child window is a little too complicated. I had an idea though, since my control displays a dialog on a mouse click, this means it must have the keyboard focus. I could display a modeless dialog and destroy it whenever a WM_KILLFOCUS is processed.

        Waldermort

        N 1 Reply Last reply
        0
        • W Waldermort

          Disabling controls of the parent window from within a child window is a little too complicated. I had an idea though, since my control displays a dialog on a mouse click, this means it must have the keyboard focus. I could display a modeless dialog and destroy it whenever a WM_KILLFOCUS is processed.

          Waldermort

          N Offline
          N Offline
          Nishad S
          wrote on last edited by
          #4

          :) That's nice. But what if the user clicks in another application and again come to yours?

          - NS -

          W 2 Replies Last reply
          0
          • N Nishad S

            :) That's nice. But what if the user clicks in another application and again come to yours?

            - NS -

            W Offline
            W Offline
            Waldermort
            wrote on last edited by
            #5

            Then they would have to click in my custom control again. I could do a comparison of the new window against the main application and it's children, but the first method is easiest to implement at this stage. We will see how it pans out.

            Waldermort

            1 Reply Last reply
            0
            • N Nishad S

              :) That's nice. But what if the user clicks in another application and again come to yours?

              - NS -

              W Offline
              W Offline
              Waldermort
              wrote on last edited by
              #6

              Well today I finaly get around to adding the code for the dialog and was hit with something quite unexpected. Setting the parent member of CreateDialogParam() to my custom control, gives me exactly what I wanted. The main window is effectivly unclickable, while the control, dialog and all other applications remain unaffected. Finally, MS got something right.

              Waldermort

              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