I want to keep a window at a certain aspect ratio (a square (x=y) in my example). I typed the following code, which basically works nice...but flickers like hell:
Code: Select all
Procedure SizeHandler()
Protected x=WindowWidth(0),y=WindowHeight(0)
If x<>y
If x<y
y=x
Else
x=y
EndIf
ResizeWindow(0,#PB_Ignore,#PB_Ignore,x,y)
EndIf
EndProcedure
OpenWindow(0,0,0,400,400,"Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_SizeGadget)
SmartWindowRefresh(0,#True)
BindEvent(#PB_Event_SizeWindow,@SizeHandler(),0)
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow



