Shaving a section from a dialog.
-
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
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. <
-
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. <
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
-
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
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. <
-
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
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
-
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. <
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
-
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
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
-
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
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.
-
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
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. <
-
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
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
-
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
I knew I had missed an option. Yes it is All, Left+Middle, Right+Middle or Middle. Thank you for the suggestion.
Alan