Resizing dialog-based app and its controls
-
I have a dialog-based app that: - displays an image in a picture control (CStatic) - has a bunch of labelled text boxes (CStatic & CEdit) - has a few other bits & pieces (CScrollbar, CComboBox, CCheckBox...) The app needs to fill as much of the available screen real-estate on the computer running it. I can resize the main dialog window easily enough... but resizing the various controls on it looks like a tedious business. It's a one-off. Am I just as well off doing the layout calculations by hand, and giving every text box label an ID other than IDC_STATIC to do it... or is there something there that will so dramatically reduce the pain of all this that it is worth learning. On the face of it, CResizableDialog is more effort than it's worth... but I stand to be corrected.
-
I have a dialog-based app that: - displays an image in a picture control (CStatic) - has a bunch of labelled text boxes (CStatic & CEdit) - has a few other bits & pieces (CScrollbar, CComboBox, CCheckBox...) The app needs to fill as much of the available screen real-estate on the computer running it. I can resize the main dialog window easily enough... but resizing the various controls on it looks like a tedious business. It's a one-off. Am I just as well off doing the layout calculations by hand, and giving every text box label an ID other than IDC_STATIC to do it... or is there something there that will so dramatically reduce the pain of all this that it is worth learning. On the face of it, CResizableDialog is more effort than it's worth... but I stand to be corrected.
I believe there's a CP class that does this as well, but you'd have to have a look for yourself, I'm not sure. Christian Graus - Microsoft MVP - C++
-
I have a dialog-based app that: - displays an image in a picture control (CStatic) - has a bunch of labelled text boxes (CStatic & CEdit) - has a few other bits & pieces (CScrollbar, CComboBox, CCheckBox...) The app needs to fill as much of the available screen real-estate on the computer running it. I can resize the main dialog window easily enough... but resizing the various controls on it looks like a tedious business. It's a one-off. Am I just as well off doing the layout calculations by hand, and giving every text box label an ID other than IDC_STATIC to do it... or is there something there that will so dramatically reduce the pain of all this that it is worth learning. On the face of it, CResizableDialog is more effort than it's worth... but I stand to be corrected.
Handle WM_SIZE message
-
I have a dialog-based app that: - displays an image in a picture control (CStatic) - has a bunch of labelled text boxes (CStatic & CEdit) - has a few other bits & pieces (CScrollbar, CComboBox, CCheckBox...) The app needs to fill as much of the available screen real-estate on the computer running it. I can resize the main dialog window easily enough... but resizing the various controls on it looks like a tedious business. It's a one-off. Am I just as well off doing the layout calculations by hand, and giving every text box label an ID other than IDC_STATIC to do it... or is there something there that will so dramatically reduce the pain of all this that it is worth learning. On the face of it, CResizableDialog is more effort than it's worth... but I stand to be corrected.
See the "Extras" section of this article.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
-
See the "Extras" section of this article.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
Thanks guys --- I ended up biting the bullet and doing it "longhand". One day I may refactor it into something like what was in David's "extras"... but it would take considerably more sophistication to cope with the kind of form layout I have --- lines with 3 or 4 edit boxes across the full screen needing to be resized proportionally in the horizontal direction, while their labels stay constant size; image "window" resized to take up the remaining space among the edit boxes & buttons...
-
Thanks guys --- I ended up biting the bullet and doing it "longhand". One day I may refactor it into something like what was in David's "extras"... but it would take considerably more sophistication to cope with the kind of form layout I have --- lines with 3 or 4 edit boxes across the full screen needing to be resized proportionally in the horizontal direction, while their labels stay constant size; image "window" resized to take up the remaining space among the edit boxes & buttons...
That's what I do too, doing each control 'by hand'. I reckon it can give a much better appearance, as various things need different changes. In fact, in some dialogs I even alter the layout as the size changes. It can be a bit of a pain to do, so it is worth doing methodically, and commenting clearly. It is easy to get into a muddle doing this kind of thing. Oh, I also take screen images and load these into graphics software so that I can enlarge them enough to be able to count the pisels. Shraddhan