Page 1 of 1

resize window without flickering

Posted: Thu Sep 01, 2005 1:02 am
by eddy
Code updated For 5.20+

Purpose : ZERO flickering in my PB app :twisted:

Code: Select all

 
;*******************************************
; READ ME
;uncomment this line if you want to force the Full-Drawing mode :
;*******************************************
;SystemParametersInfo_( #SPI_SETDRAGFULLWINDOWS, 1, 0, #SPIF_SENDWININICHANGE)
;

;Get state of Full-Drawing mode
Global CurrentDrawMode
Global DrawLocked
SystemParametersInfo_( #SPI_GETDRAGFULLWINDOWS, 0, @CurrentDrawMode, 0) ;-> CurrentDrawMode=1

#WM_CAPTURECHANGED=$215     

Procedure CB(Window, Message, wParam, lParam)
  Result = #PB_ProcessPureBasicEvents
  
  If Window=WindowID(0)
    Select Message
      Case #WM_NCLBUTTONDOWN
        If DrawLocked=0
          ;disable full-drawing mode
          SystemParametersInfo_( #SPI_SETDRAGFULLWINDOWS, 0, 0, #SPIF_SENDWININICHANGE)
          Debug "draw OFF"
          DrawLocked=1 
        EndIf
        
      Case #WM_CAPTURECHANGED
        Debug "draw ON"
        If DrawLocked And lParam<>Window
          ;restore full-drawing mode
          SystemParametersInfo_( #SPI_SETDRAGFULLWINDOWS, CurrentDrawMode, 0, #SPIF_SENDWININICHANGE   )           
          Debug "enable"               
          DrawLocked=0
        EndIf
        
        ;Case #WM_NCLBUTTONUP
        ;   Debug "test button UP"
        ;Case #WM_SIZING
        ;   Debug "resize"
        ;Case #WM_SIZE
        ;   Debug "resize END" 
        ;Case #WM_WINDOWPOSCHANGING
        ;   Debug "winpos changing"
        ;Case #WM_WINDOWPOSCHANGED
        ;   Debug "winpos changed"
    EndSelect
  EndIf
  
  ProcedureReturn Result
EndProcedure

If OpenWindow(0,100,100,200,200,"No Drawing",#PB_Window_SystemMenu|#PB_Window_SizeGadget)
  OpenWindow(1,400,100,200,200,"Full Drawing",#PB_Window_SystemMenu|#PB_Window_SizeGadget)   
  SetWindowCallback(@CB())
  
  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf

Posted: Thu Sep 01, 2005 11:55 am
by ts-soft
you change the userconfiguration for all windows. :shock:

Posted: Thu Sep 01, 2005 12:22 pm
by eddy
LOL its just an example.
You have to code your own function.