Page 1 of 1

Window Resize (inconsistency)

Posted: Wed Aug 12, 2009 12:20 pm
by cas
I guess that this is something that needed to be sacrificed for cross-platform compiling to be possible without code modification but is there any workaround to fix this problem? I tried many applications and none of them is behaving like application written in purebasic.

Here is example of resizing to bottom of desktop how should work, as you can see, you can't resize it over taskbar, it stops as soon your mouse reaches it, seems logical.
Image

But with purebasic, resize doesn't stop and you can resize it behind statusbar, this happens in all versions of Windows, not just Windows 7:
Image

I guess that this purebasic 'feature' is related with one more feature: Aero Snap so this is not working with purebasic application, on first screenshot you can see that this feature is triggered but on second one (purebasic window) not. :cry:

Thanks for any help.

Posted: Wed Aug 12, 2009 1:13 pm
by gnozal
The same problem exists with older windows versions where you can resize a window over the taskbar.
This could help :

Code: Select all

Procedure WinCallback(hwnd, uMsg, wParam, lParam) 
  Protected *WinRect.RECT, WORKAREA.RECT, CurPos.POINT
  If uMsg = #WM_SIZING
    Select wParam 
      Case #WMSZ_BOTTOM, #WMSZ_BOTTOMLEFT, #WMSZ_BOTTOMRIGHT
        *WinRect = lParam
        SystemParametersInfo_(#SPI_GETWORKAREA, 0, @WORKAREA, 0) 
        If *WinRect\bottom > WORKAREA\bottom
          *WinRect\bottom = WORKAREA\bottom
          GetCursorPos_(@CurPos)
          SetCursorPos_(CurPos\x, WORKAREA\bottom)
          ProcedureReturn #True 
        EndIf
    EndSelect
  EndIf 
  ProcedureReturn #PB_ProcessPureBasicEvents 
EndProcedure 
  
If OpenWindow(0, 450, 200, 428, 358, "Resize me !", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
  SetWindowCallback(@WinCallback())
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Break
    EndSelect
  ForEver
EndIf

Posted: Wed Aug 12, 2009 4:38 pm
by cas
Thanks, that's exactly what i need.