-
November 6th, 2013, 02:38 PM
#1
OnSize Handler Not Behaving As Expected
I keep having problems with CMFCPropertySheets. I now have it embedded in a resizable dialog and the property sheet and page gets resized when dialog is resized all that is working fine.
Problem is OnSize is being called when the dialog is being resized NOT when it has finished resizing so the values reported in cx and cy is the old size not the size AFTER resizing. What could be causing this? Isn't OnSize call AFTER the size has been changed and OnSizing called WHILE the size is being changed?
I have a list control that needs to take up full rect in each page and when the dialog is maximized it stays at previous size even though the sheet and page have both maximized as they should.
I ran a trace on the OnSize even for both the sheet and page and OnSize is being called during the sizing and not after it has already been sized like it is supposed to.
-
November 6th, 2013, 02:49 PM
#2
Re: OnSize Handler Not Behaving As Expected
Originally Posted by RobNHood
Problem is OnSize is being called when the dialog is being resized NOT when it has finished resizing so the values reported in cx and cy is the old size not the size AFTER resizing. What could be causing this? Isn't OnSize call AFTER the size has been changed and OnSizing called WHILE the size is being changed?
Define " is being resized NOT when it has finished resizing"
Victor Nijegorodov
-
November 6th, 2013, 02:54 PM
#3
Re: OnSize Handler Not Behaving As Expected
OnSize is being called while the mouse button is down and resizing the window. When the mouse button is released it is not called for the final size so it is basically acting like the OnSizing event not the OnSize event. When the maximize button is pressed and the dialog goes from its current size to full maximized cx and cy and also GetClientRect report the old size and not the new maximized size.
-
November 6th, 2013, 04:00 PM
#4
Re: OnSize Handler Not Behaving As Expected
Originally Posted by RobNHood
OnSize is being called while the mouse button is down and resizing the window. When the mouse button is released it is not called for the final size so it is basically acting like the OnSizing event not the OnSize event. When the maximize button is pressed and the dialog goes from its current size to full maximized cx and cy and also GetClientRect report the old size and not the new maximized size.
Did you read the documentation (MSDN) about WM_SIZE and WM_SIZING messages?
Victor Nijegorodov
-
November 6th, 2013, 04:08 PM
#5
Re: OnSize Handler Not Behaving As Expected
Yes I did and it says exactly the same think I expected. OnSize is called after the window has changed size and OnSizing is called while the window is being resized.
-
November 6th, 2013, 03:30 PM
#6
Re: OnSize Handler Not Behaving As Expected
You need to call the GetClientRect member of the CPropertySheet, not the CPropertyPage. Or if you are using the ::GetClientRect(hWnd, ...) api, pass in the handle of the property sheet.
-
November 7th, 2013, 08:00 AM
#7
Re: OnSize Handler Not Behaving As Expected
The WM_SIZE will get called similarly to WM_SIZING (just slightly later) when you have your WIndows set to allow
On windows 8
Control Panel > System and security > system
CLick "Performance information and tools" in the left panel (bottom)
Click Adjust visual effects in the left panel
WM_SIZE will behave similar to WM_SIZING when the "show window contents while dragging" is checked.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|