Window Resize (inconsistency)

Windows specific forum
cas
Enthusiast
Enthusiast
Posts: 597
Joined: Mon Nov 03, 2008 9:56 pm

Window Resize (inconsistency)

Post 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.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
cas
Enthusiast
Enthusiast
Posts: 597
Joined: Mon Nov 03, 2008 9:56 pm

Post by cas »

Thanks, that's exactly what i need.
Post Reply