CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2013
    Location
    USA
    Posts
    30

    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.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: OnSize Handler Not Behaving As Expected

    Quote Originally Posted by RobNHood View Post
    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

  3. #3
    Join Date
    Jul 2013
    Location
    USA
    Posts
    30

    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.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    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.

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: OnSize Handler Not Behaving As Expected

    Quote Originally Posted by RobNHood View Post
    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

  6. #6
    Join Date
    Jul 2013
    Location
    USA
    Posts
    30

    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.

  7. #7
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    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
  •  





Click Here to Expand Forum to Full Width

Featured