Page 1 of 1

Exe including in splitter flickering when resize

Posted: Sat Dec 20, 2025 9:48 pm
by Kwai chang caine
Hello at all

I try to include externals executables in a splitterGadget
I don't know if it's the good and more simple way for do this, but i put it in a container
And when i resize the splitter left to right, the exe loose his color and flickering :|

Have you an idea for adding fluidity ?

This is the zip with redwindow

https://prov.reec.fr/SplitterGadget.zip

and the code

Code: Select all

; https://www.purebasic.fr/english/viewtopic.php?p=45782#p45782

Procedure WindowProc(hWnd,Msg,wParam,lParam)

 result = #PB_ProcessPureBasicEvents
 
 If Msg = #WM_SIZE And hWnd = WindowID(0)
 
  ResizeGadget(5,0,0,lParam&$FFFF,(lParam>>16)&$FFFF)
  result = 0
  
 ElseIf Msg = #WM_SIZE And hWnd = GadgetID(2)
  
  RedrawWindow_(GadgetID(2), 0, 0, #RDW_INVALIDATE|#RDW_UPDATENOW)
  result = 0
 EndIf
 
 ProcedureReturn result
 
EndProcedure

OpenWindow(0,0,0,800,600,"Split",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
ListIconGadget(1,0,0,0,0,"Title",200,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
EditorGadget(3,0,0,0,0)
ContainerGadget(2,0,0,0,0)
CloseGadgetList()

; splitter1: listicon and editor1
SplitterGadget(4,0,0,500,300,1,2,#PB_Splitter_Vertical|#PB_Splitter_Separator)
SetGadgetState(4,350) ; Set splitter width

; splitter2: splitter1 and editor2
SplitterGadget(5,0,0,800,600,4,3,#PB_Splitter_Separator)
SetGadgetState(5,500) ; Set splitter width
SetWindowCallback(@WindowProc())

; Insert executable
RedWindow = RunProgram(GetPathPart(ProgramFilename()) + "FenetreRouge.exe","",GetPathPart(ProgramFilename()), #PB_Program_Open|#PB_Program_Hide)

If RedWindow
 While hRedWindow = #Null
  hRedWindow = FindWindow_(0, "RedWindow")
 Wend
EndIf

SetParent_(hRedWindow, GadgetID(2))
ShowWindow_(hRedWindow, #SW_SHOWMAXIMIZED)
RedrawWindow_(GadgetID(2), 0, 0, #RDW_INVALIDATE|#RDW_UPDATENOW)

Repeat
 
 Event = WaitWindowEvent()
 
Until Event = #PB_Event_CloseWindow

KillProgram(RedWindow)
Have a good day

Re: Exe including in splitter flickering when resize

Posted: Sun Dec 21, 2025 12:14 am
by ChrisR
Hi Kcc,
I played with it, it's an interesting idea, it seems better with:

Code: Select all

Global hRedWindow

Procedure Splitter4Proc()
  Static SplitterPosition
  If (SplitterPosition <> GetGadgetState(EventGadget())) Or (SplitterPosition = 0)
    SetWindowPos_(hRedWindow, 0, 0, 0, DesktopScaledX(GadgetWidth(2)), DesktopScaledY(GadgetHeight(2)), #SWP_SHOWWINDOW)
    RedrawWindow_(hRedWindow,  #Null, #Null, #RDW_INVALIDATE | #RDW_UPDATENOW)
    RedrawWindow_(GadgetID(1), #Null, #Null, #RDW_INVALIDATE | #RDW_UPDATENOW)
    SplitterPosition = GetGadgetState(EventGadget())
  EndIf
EndProcedure

Procedure Splitter5Proc()
  Static SplitterPosition
  If (SplitterPosition <> GetGadgetState(EventGadget())) Or (SplitterPosition = 0)
    SetWindowPos_(hRedWindow, 0, 0, 0, DesktopScaledX(GadgetWidth(2)), DesktopScaledY(GadgetHeight(2)), #SWP_SHOWWINDOW)
    RedrawWindow_(hRedWindow,  #Null, #Null, #RDW_INVALIDATE | #RDW_UPDATENOW)
    RedrawWindow_(GadgetID(1), #Null, #Null, #RDW_INVALIDATE | #RDW_UPDATENOW)
    RedrawWindow_(GadgetID(3), #Null, #Null, #RDW_INVALIDATE | #RDW_UPDATENOW)
    SplitterPosition = GetGadgetState(EventGadget())
  EndIf
EndProcedure 

Procedure Resize_Window()
  ResizeGadget(5, #PB_Ignore, #PB_Ignore, WindowWidth(0), WindowHeight(0))
  RedrawWindow_(hRedWindow,  #Null, #Null, #RDW_INVALIDATE | #RDW_UPDATENOW)
EndProcedure

OpenWindow(0,0,0,800,600,"Split",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
ListIconGadget(1,0,0,0,0,"Title",200,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
EditorGadget(3,0,0,0,0)
ContainerGadget(2,0,0,0,0)
CloseGadgetList()

; splitter1: listicon1 and Container2
SplitterGadget(4,0,0,500,300,1,2,#PB_Splitter_Vertical|#PB_Splitter_Separator)
SetGadgetState(4,350) ; Set splitter width

; splitter2: splitter4 and editor3
SplitterGadget(5,0,0,800,600,4,3,#PB_Splitter_Separator)
SetGadgetState(5,500) ; Set splitter width

BindGadgetEvent(4, @Splitter4Proc())
BindGadgetEvent(5, @Splitter5Proc())
BindEvent(#PB_Event_SizeWindow, @Resize_Window(), 0)

; Insert executable
RedWindow = RunProgram(GetPathPart(ProgramFilename()) + "FenetreRouge.exe","",GetPathPart(ProgramFilename()), #PB_Program_Open|#PB_Program_Hide)
If RedWindow
  Delay(100)   ;Delay for Loading time
  hRedWindow = FindWindow_(0, "RedWindow")
  If hRedWindow
    SetWindowLongPtr_(hRedWindow, #GWL_STYLE, GetWindowLongPtr_(hRedWindow, #GWL_STYLE) | #WS_CHILD & ~#WS_POPUP & ~#WS_CAPTION & ~#WS_THICKFRAME)
    SetParent_(hRedWindow, GadgetID(2))
    SetWindowPos_(hRedWindow, 0, 0, 0, DesktopScaledX(GadgetWidth(2)), DesktopScaledY(GadgetHeight(2)), #SWP_SHOWWINDOW)
    RedrawWindow_(hRedWindow,  #Null, #Null,  #RDW_INVALIDATE | #RDW_UPDATENOW)
  EndIf
  
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
  
  KillProgram(RedWindow)
  CloseProgram(RedWindow)
EndIf

Re: Exe including in splitter flickering when resize

Posted: Sun Dec 21, 2025 11:51 am
by Kwai chang caine
Hello ChrisR glad to talk to you :D

I have try your code and i not believe my eyes :shock:
Fly far go away the flickering, I even thought you had colored the splitter and not use the EXE :lol:
It's perfect, we good see, It's clear that we're dealing with the creator of the splendid VD IceDesigner 8)

RESPECT Image

Thank you a lot 8)

Justly, you who are a specialist, what is your advice about, how is the best practice for create an empty or very basic software, and can adding tools time after time ?

1/ I have thinking to all in one, but after adding and mixing several code tools, the code is to hard to manage, and the managing of events too
2/ Then i have thinking to the PBI, but we must always compiled each time, like the solution 1, so it's not really an addon
3/ The DLL, seems to be one of the best solutions (She create when even for that in fact) but are there no limitations in the windows and gadgets and their management ?
4/ The exe embedding like my RedWindow, but you see it's seem not to be also simple, already the first resize i try...you must help KCC :oops:

Or perhaps another methods exists, what i have not thinking :wink:

It's for my project of WebIde i have already talking on the forum

viewtopic.php?t=87995

i have begining, and working on it since this time
Thanks to the helps of my friends members, i have already the ClientSSH (Infratec), the client SFTP, several kinds members give to me beginning of IDE for help me with scintilla, i have also finally recover mine after numerous search :evil: that i have begin there are a long time
I have also discovered the power of AI, and I alone, must occupy half the world's servers :mrgreen:

And now, it's the moment to know how articulate all this tools
I have thinking it's better to my little brain, to create each function in a separate tool (Two advantages, more "easy" to coding and managing one by one, more encouraging, and furtermore can be used alone, out of the WebIde)
But now....how integrate it with serious method, not KCC method as per usual :mrgreen: :oops:

Re: Exe including in splitter flickering when resize

Posted: Sun Dec 21, 2025 2:20 pm
by Kwai chang caine
I have adding a textgadget and tested but that flickering again :cry:

Code: Select all

Hwnd = OpenWindow(0,0,0,800,600,"RedWindow", #PB_Window_BorderLess)
StringGadget(1, 10,10, 300, 200, "")
SetWindowColor(0, #Red)

Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow

Re: Exe including in splitter flickering when resize

Posted: Sun Dec 21, 2025 5:00 pm
by chi
You have to tell the ContainerGadget (parent) not to draw the part that the RedWindow (child) covers... aka #WS_CLIPCHILDREN

Code: Select all

; https://www.purebasic.fr/english/viewtopic.php?p=45782#p45782

Procedure WindowProc(hWnd,Msg,wParam,lParam)  
  result = #PB_ProcessPureBasicEvents
  
  If Msg = #WM_SIZE And hWnd = WindowID(0)    
    ResizeGadget(5,0,0,lParam&$FFFF,(lParam>>16)&$FFFF)
    result = 0    
  ;ElseIf Msg = #WM_SIZE And hWnd = GadgetID(2)    
    ;RedrawWindow_(GadgetID(2), 0, 0, #RDW_INVALIDATE|#RDW_UPDATENOW)
    ;result = 0
  EndIf
  
  ProcedureReturn result  
EndProcedure

OpenWindow(0,0,0,800,600,"Split",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
ListIconGadget(1,0,0,0,0,"Title",200,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
ContainerGadget(2,0,0,0,0)
CloseGadgetList()
SetWindowLongPtr_(GadgetID(2), #GWL_STYLE, GetWindowLongPtr_(GadgetID(2), #GWL_STYLE)|#WS_CLIPCHILDREN) ; <- important
EditorGadget(3,0,0,0,0)

; splitter1: listicon and editor1
SplitterGadget(4,0,0,500,300,1,2,#PB_Splitter_Vertical|#PB_Splitter_Separator)
SetGadgetState(4,350) ; Set splitter width

; splitter2: splitter1 and editor2
SplitterGadget(5,0,0,800,600,4,3,#PB_Splitter_Separator)
SetGadgetState(5,500) ; Set splitter width
SetWindowCallback(@WindowProc())

; Insert executable
RedWindow = RunProgram(GetPathPart(ProgramFilename()) + "FenetreRouge.exe","",GetPathPart(ProgramFilename()), #PB_Program_Open|#PB_Program_Hide)

If RedWindow
  While hRedWindow = #Null
    hRedWindow = FindWindow_(0, "RedWindow")
  Wend
EndIf

SetParent_(hRedWindow, GadgetID(2))
;ShowWindow_(hRedWindow, #SW_SHOWMAXIMIZED)
;RedrawWindow_(GadgetID(2), 0, 0, #RDW_INVALIDATE|#RDW_UPDATENOW)

Repeat
  
  Event = WaitWindowEvent()
  
Until Event = #PB_Event_CloseWindow

KillProgram(RedWindow)