Re: limiting size for a window
- Posted by euphoric (admin) Jun 11, 2010
- 2237 views
It probably doesn't work because this isn't the correct way to do it. You want to check the dimensions before the resize, not re-resize the window after it is resized.
I disagree, you have to check to dementions after the resize to see if they fit your requirments.
...and it does work. If the window is smaller than 400,300 then it snaps back to 400,300.
Don, CoJaBo is right. The "snapping back" behavior to which you refer occurs in Win32Lib-IDE and it's aggravating to say the least. The correct way to do it is to not allow the window to be sized beyond the bounds in the first place.
See the two libs I referenced in a prior post. They make use of the WM_GETMINMAXINFO to PREVENT your window from going outside the bounds you set, as opposed to making it snap back (which is ridiculous from a UI perspective).
I wish I had time to work up an example, because the difference from a UI perspective is as clear as night from day.