Your latest example has the terrible glitching again, no matter if I set #USEWINAPI to 0 or 1. Don't know if you expected it to be gone, or just using that code as a different example?
SplitterGadget with more than two gadgets
Re: SplitterGadget with more than two gadgets
Re: SplitterGadget with more than two gadgets
This is just another case that also has an impact on the splitter problem. On my machine the glitching with SetWindowPos has almost disappeared, but with ResizeGadget I have a similar experience to yours...BarryG wrote: Fri May 03, 2024 1:23 amYour latest example has the terrible glitching again, no matter if I set #USEWINAPI to 0 or 1. Don't know if you expected it to be gone, or just using that code as a different example?

Et cetera is my worst enemy
Re: SplitterGadget with more than two gadgets
Here's how it looks on my PCs:


Re: SplitterGadget with more than two gadgets
This flicker problem is why I never used SplitterGadget in PB 
I've the same problem as you BarryG.
It's better with ChrisR code by adding 2 more UpdateWindow_() for gadget 0 and 1 in BindSplitterH() procedure :
I've the same problem as you BarryG.
It's better with ChrisR code by adding 2 more UpdateWindow_() for gadget 0 and 1 in BindSplitterH() procedure :
Code: Select all
Global OldProc
Procedure SplitterProc(hWnd, uMsg, wParam, lParam)
Static SplitterPos
Select uMsg
Case #WM_NCDESTROY
Case #WM_PAINT
Protected Position = GetGadgetState(GetProp_(hWnd, "PB_ID"))
If SplitterPos <> Position
SplitterPos = Position
Else
ProcedureReturn #False
EndIf
EndSelect
ProcedureReturn CallWindowProc_(OldProc, hWnd, uMsg, wParam, lParam)
EndProcedure
Procedure BindSplitterV()
Static SplitterPos
Protected Position = GetGadgetState(EventGadget())
If SplitterPos <> Position
SplitterPos = Position
UpdateWindow_(GadgetID(0))
UpdateWindow_(GadgetID(1))
Debug "Vertical Splitter new position: " + Position
Else
Debug "Vertical Splitter Event received without position change: " + Position + " !"
EndIf
EndProcedure
Procedure BindSplitterH()
Static SplitterPos
Protected Position = GetGadgetState(EventGadget())
If SplitterPos <> Position
SplitterPos = Position
UpdateWindow_(GadgetID(3))
UpdateWindow_(GadgetID(0))
UpdateWindow_(GadgetID(1))
Debug "Horizontal Splitter new position: " + Position
Else
Debug "Horizontal Event received without position change: " + Position + " !"
EndIf
EndProcedure
Procedure WinResize()
ResizeGadget(4, #PB_Ignore, #PB_Ignore, WindowWidth(0)-10, WindowHeight(0)-10)
EndProcedure
OpenWindow(0, 0, 0, 400, 400, "Splitter", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible)
ExplorerListGadget(0, 0, 0, 0, 0, GetUserDirectory(#PB_Directory_Desktop))
ExplorerListGadget(1, 0, 0, 0, 0, GetUserDirectory(#PB_Directory_Pictures))
SplitterGadget(2, 5, 5, 390, 390, 0, 1, #PB_Splitter_Vertical)
BindGadgetEvent(2, @BindSplitterV())
ExplorerListGadget(3, 0, 0, 0, 0, GetHomeDirectory())
SplitterGadget(4, 5, 5, 390, 390, 2, 3, #PB_Splitter_Separator)
BindGadgetEvent(4, @BindSplitterH())
SetGadgetState(4, 250)
; SubClass Splitter for WM_PAINT message can also help
;OldProc = GetWindowLongPtr_(GadgetID(4), #GWLP_WNDPROC)
;SetWindowLongPtr_(GadgetID(4), #GWLP_WNDPROC, @SplitterProc())
BindEvent(#PB_Event_SizeWindow, @WinResize())
HideWindow(0, #False)
While WaitWindowEvent() <> #PB_Event_CloseWindow : WendWindows 10 Pro x64
PureBasic 6.20 x64
PureBasic 6.20 x64
Re: SplitterGadget with more than two gadgets
Thanks, tatanas! That fixed it for me.
And glad to know I wasn't the only one who had the glitches.

