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. Shaving a section from a dialog.

Shaving a section from a dialog.

Scheduled Pinned Locked Moved C / C++ / MFC
questiondesignhelp
11 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.
  • S Spawn Melmac

    Ok I know this is a bit of a cheat but my UI is split into 3rds with the idea being I can hide the bits of the UI. Now I can slice off the right hand side easily enough as follows.

    ...
    CRect rect;
    GetWindowRect(rect);
    ...
    rect.right += CONSOLE_SIZE;
    MoveWindow(rect, 1);
    ...

    The problem I am having is how do I cut the dialog's window down so that only the middle 3rd is displayed? I have had a look at CRgn with the SetWindowRgn but I am getting nowhere. Any suggestions would be appreciated. Many thanks

    Alan

    C Offline
    C Offline
    Code o mat
    wrote on last edited by
    #2

    You could try making your dialog a child of another dialog. You'd have a popup dialog and inside its client area a child dialog with its controls, thus you can shift this child dialog inside the popup's client area to show the part you wish. On a sidenote: i don't know what kind of controls you have on your dialog, but if you use the keyboard, you can tab around controls even if they are not visible because they are "outside" of the visible client area. So if you tab onto a button you can press it by using SPACE even though you don't see it.

    > The problem with computers is that they do what you tell them to do and not what you want them to do. < > "It doesn't work, fix it" does not qualify as a bug report. < > Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <

    D 1 Reply Last reply
    0
    • C Code o mat

      You could try making your dialog a child of another dialog. You'd have a popup dialog and inside its client area a child dialog with its controls, thus you can shift this child dialog inside the popup's client area to show the part you wish. On a sidenote: i don't know what kind of controls you have on your dialog, but if you use the keyboard, you can tab around controls even if they are not visible because they are "outside" of the visible client area. So if you tab onto a button you can press it by using SPACE even though you don't see it.

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > "It doesn't work, fix it" does not qualify as a bug report. < > Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #3

      Code-o-mat wrote:

      ...but if you use the keyboard, you can tab around controls even if they are not visible...

      Unless they are also disabled, then they get skipped over.

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "Man who follows car will be exhausted." - Confucius

      C 1 Reply Last reply
      0
      • D David Crow

        Code-o-mat wrote:

        ...but if you use the keyboard, you can tab around controls even if they are not visible...

        Unless they are also disabled, then they get skipped over.

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "Man who follows car will be exhausted." - Confucius

        C Offline
        C Offline
        Code o mat
        wrote on last edited by
        #4

        Of course...also if they are hidden by ShowWindow(SW_HIDE), my point was, just by "not being seen" doesn't mean "not there at all" :)

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > "It doesn't work, fix it" does not qualify as a bug report. < > Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <

        S 1 Reply Last reply
        0
        • S Spawn Melmac

          Ok I know this is a bit of a cheat but my UI is split into 3rds with the idea being I can hide the bits of the UI. Now I can slice off the right hand side easily enough as follows.

          ...
          CRect rect;
          GetWindowRect(rect);
          ...
          rect.right += CONSOLE_SIZE;
          MoveWindow(rect, 1);
          ...

          The problem I am having is how do I cut the dialog's window down so that only the middle 3rd is displayed? I have had a look at CRgn with the SetWindowRgn but I am getting nowhere. Any suggestions would be appreciated. Many thanks

          Alan

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #5

          I find the easiest way to make such a dialog is to add a hidden 1x1 static control to the dialog where the expansion will take place. In your case, you'd need two. Then when the "shrink" button is clicked, you'd shrink the dialog's left and right edges up to those hidden controls. When the "expand" button is clicked, you'd grow the dialog's left and right edges back to their original position.

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "Man who follows car will be exhausted." - Confucius

          S 1 Reply Last reply
          0
          • C Code o mat

            Of course...also if they are hidden by ShowWindow(SW_HIDE), my point was, just by "not being seen" doesn't mean "not there at all" :)

            > The problem with computers is that they do what you tell them to do and not what you want them to do. < > "It doesn't work, fix it" does not qualify as a bug report. < > Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <

            S Offline
            S Offline
            Spawn Melmac
            wrote on last edited by
            #6

            I take your point but there are no input controls on the area being hidden. Put simply, as a user of the system you only get to see the bits you have permission to see. All, Left+Middle or Right+Middle.

            Alan

            C 1 Reply Last reply
            0
            • D David Crow

              I find the easiest way to make such a dialog is to add a hidden 1x1 static control to the dialog where the expansion will take place. In your case, you'd need two. Then when the "shrink" button is clicked, you'd shrink the dialog's left and right edges up to those hidden controls. When the "expand" button is clicked, you'd grow the dialog's left and right edges back to their original position.

              "One man's wage rise is another man's price increase." - Harold Wilson

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              "Man who follows car will be exhausted." - Confucius

              S Offline
              S Offline
              Spawn Melmac
              wrote on last edited by
              #7

              hmmm... sounds a very messy way of cutting off the left hand edge. The object is to show All, Left+Middle or Right+Middle.

              Alan

              D 1 Reply Last reply
              0
              • S Spawn Melmac

                Ok I know this is a bit of a cheat but my UI is split into 3rds with the idea being I can hide the bits of the UI. Now I can slice off the right hand side easily enough as follows.

                ...
                CRect rect;
                GetWindowRect(rect);
                ...
                rect.right += CONSOLE_SIZE;
                MoveWindow(rect, 1);
                ...

                The problem I am having is how do I cut the dialog's window down so that only the middle 3rd is displayed? I have had a look at CRgn with the SetWindowRgn but I am getting nowhere. Any suggestions would be appreciated. Many thanks

                Alan

                M Offline
                M Offline
                Maximilien
                wrote on last edited by
                #8

                Could it be easier to have a series of child dialogs to display/hide part of the main dialog and resize the main dialog accordingly ?

                Watched code never compiles.

                1 Reply Last reply
                0
                • S Spawn Melmac

                  I take your point but there are no input controls on the area being hidden. Put simply, as a user of the system you only get to see the bits you have permission to see. All, Left+Middle or Right+Middle.

                  Alan

                  C Offline
                  C Offline
                  Code o mat
                  wrote on last edited by
                  #9

                  All right, just trying to help. :)

                  > The problem with computers is that they do what you tell them to do and not what you want them to do. < > "It doesn't work, fix it" does not qualify as a bug report. < > Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <

                  1 Reply Last reply
                  0
                  • S Spawn Melmac

                    hmmm... sounds a very messy way of cutting off the left hand edge. The object is to show All, Left+Middle or Right+Middle.

                    Alan

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #10

                    Spawn@Melmac wrote:

                    hmmm... sounds a very messy way of cutting off the left hand edge.

                    Not messy at all. In fact it is very clean and quite common to grow/shrink dialogs in this fashion.

                    Spawn@Melmac wrote:

                    The object is to show All, Left+Middle or Right+Middle.

                    Even though you initially stated, "...how do I cut the dialog's window down so that only the middle 3rd is displayed", what I described will work just fine for all seven possibilities.

                    "One man's wage rise is another man's price increase." - Harold Wilson

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    "Man who follows car will be exhausted." - Confucius

                    S 1 Reply Last reply
                    0
                    • D David Crow

                      Spawn@Melmac wrote:

                      hmmm... sounds a very messy way of cutting off the left hand edge.

                      Not messy at all. In fact it is very clean and quite common to grow/shrink dialogs in this fashion.

                      Spawn@Melmac wrote:

                      The object is to show All, Left+Middle or Right+Middle.

                      Even though you initially stated, "...how do I cut the dialog's window down so that only the middle 3rd is displayed", what I described will work just fine for all seven possibilities.

                      "One man's wage rise is another man's price increase." - Harold Wilson

                      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                      "Man who follows car will be exhausted." - Confucius

                      S Offline
                      S Offline
                      Spawn Melmac
                      wrote on last edited by
                      #11

                      I knew I had missed an option. Yes it is All, Left+Middle, Right+Middle or Middle. Thank you for the suggestion.

                      Alan

                      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