Exe including in splitter flickering when resize

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5614
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Exe including in splitter flickering when resize

Post 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
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
ChrisR
Addict
Addict
Posts: 1544
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Exe including in splitter flickering when resize

Post 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
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5614
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Exe including in splitter flickering when resize

Post 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:
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5614
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Exe including in splitter flickering when resize

Post 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
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
chi
Addict
Addict
Posts: 1090
Joined: Sat May 05, 2007 5:31 pm
Location: Austria

Re: Exe including in splitter flickering when resize

Post 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)
Et cetera is my worst enemy
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5614
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Exe including in splitter flickering when resize

Post by Kwai chang caine »

Hello CHI :D

INCREDIBLE !!!!!

Image

Just removing few lines, and the miracle appears :shock:
You have right no flickering...thanks a lot 8)

On the other hand, i'm when even forced to decomment the two lines

Code: Select all

;ShowWindow_(hRedWindow, #SW_SHOWMAXIMIZED)
;RedrawWindow_(GadgetID(2), 0, 0, #RDW_INVALIDATE|#RDW_UPDATENOW)
Otherwise the redwindow not appears :wink:

Like we talk about miracle, believe you it's possible to resize the redwindow the same size than spliter 2 ? :oops:
I have try with MoveWindow_ or setwindowpos , and like usualy for KCC...that not works :|
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
chi
Addict
Addict
Posts: 1090
Joined: Sat May 05, 2007 5:31 pm
Location: Austria

Re: Exe including in splitter flickering when resize

Post by chi »

Hi KCC, this should work as desired :)

Code: Select all

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

Global hRedWindow

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) And hRedWindow    
    SetWindowPos_(hRedWindow, #HWND_TOP, 0, 0, GadgetWidth(2), GadgetHeight(2), #SWP_NOZORDER|#SWP_NOACTIVATE)
    result = 0
  EndIf  
  
  ProcedureReturn result  
EndProcedure

OpenWindow(0,0,0,800,600,"Split",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget)
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))
SetWindowPos_(hRedWindow, #HWND_TOP, 0, 0, GadgetWidth(2), GadgetHeight(2), #SWP_NOZORDER|#SWP_NOACTIVATE|#SWP_SHOWWINDOW)

Repeat
  
  Event = WaitWindowEvent()
  
Until Event = #PB_Event_CloseWindow

KillProgram(RedWindow)
Et cetera is my worst enemy
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5614
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Exe including in splitter flickering when resize

Post by Kwai chang caine »

Double Waouuhhh!!! MASTER CHI 8)
It's exactely what i search to do

Thanks to you, i have decided what way i take for create my little WebIde 8)
These will be executables embedded in a parent window, with splitter, panel etc...like you show to me :wink:

I think it's the better simple way, for coding and managing code, no problem with the mix of events, the too much long code, and furthermore each tool can run alone in external mode :idea: 8)

One million of thanks
And have the better day of the year :wink:
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5614
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Exe including in splitter flickering when resize

Post by Kwai chang caine »

I move, i move thanks to you two 8)

1/ I have choose my method (Finally i believe :oops:)
2/ I have a nice code for embedding external applications

But obviously...i have again 2 problems (otherwise... I wouldn't be KCC :mrgreen:)

1/ Even if i i write #PB_Program_Hide, the addons appears out of mainwindow before is embeded :shock: and i don't understand why :oops:

2/ I have a flickering if i resize the horizontal splitter, but not the vertical ...
Have i make an error in the splendid code of CHI ?

https://prov.reec.fr/SplitterGadget_CHI.zip
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
ChrisR
Addict
Addict
Posts: 1544
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Exe including in splitter flickering when resize

Post by ChrisR »

Thanks chi for WS_CLIPCHILDREN, that's the right way to do it indeed.
I should have thought about it! it should be the first to test with Spliter, and that's what I use for properties in my app.
I noticed a strange little detail, if you resize the window before resizing the splitters, the splitter at the bottom disappears and is no longer accessible.

Then, personally, even though the idea is interesting, I'm not sure I would use it that way :?
User avatar
chi
Addict
Addict
Posts: 1090
Joined: Sat May 05, 2007 5:31 pm
Location: Austria

Re: Exe including in splitter flickering when resize

Post by chi »

@KCC:
1/ You could probably use #PB_Window_Invisible for the Red, Yellow and Blue Window. After embedding into the ParentWin use #SW_SHOW or #SWP_SHOWWINDOW to make them visible.

2/ Try adding SetWindowLongPtr_(WindowID(0), #GWL_STYLE, GetWindowLongPtr_(WindowID(0), #GWL_STYLE)|#WS_CLIPCHILDREN) to the Red, Yellow and Blue Window too. But it's hard to tell.

@ChrisR:
Hi, sadly WS_CLIPCHILDREN comes with its own problems (resize performance, menu flickering, ...), so you can't just apply it to everything :)


Wish you guys happy holidays!
Et cetera is my worst enemy
User avatar
ChrisR
Addict
Addict
Posts: 1544
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Exe including in splitter flickering when resize

Post by ChrisR »

Thanks and happy holidays!

@KCC in your Structure Addon replace .l by .i
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5614
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Exe including in splitter flickering when resize

Post by Kwai chang caine »

Thanks a lot at you two for your precious helps 8)
I try to apply all your advices and keeps you informed :wink:
CHI wrote:You could probably use #PB_Window_Invisible for the Red,
Since three days i create and open windows color...i see it everywhere ....on my bed, my table, when eating :mrgreen:
I take a look again thanks
CHI wrote:Wish you guys happy holidays!
Me too...me too :D

Image
ChrisR wrote:@KCC in your Structure Addon replace .l by .i
Ok i do that again thanks :wink: 8)
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5614
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Exe including in splitter flickering when resize

Post by Kwai chang caine »

CHI wrote: You could probably use #PB_Window_Invisible for the Red, Yellow and Blue Window. After embedding into the ParentWin use #SW_SHOW or #SWP_SHOWWINDOW to make them visible.
It's a good idea :idea:
I try it, and that works perfectly 8)
I have even adding the #PB_Window_Invisible on the main window and showing when all the soup is passed...and it's more cool again :mrgreen:
Thanks a lot for this tips

After..That doesn't explain why my windows won't hide; :shock: :|
Maybe they want to be stars. :mrgreen:
business to follow...

I have adding the
SetWindowLongPtr_(WindowID(0), #GWL_STYLE, GetWindowLongPtr_(WindowID(0), #GWL_STYLE)|#WS_CLIPCHILDREN)
in the loop and after the loop...and always this flickering with the horizontal splitter when you up to the top and dow :|
https://prov.reec.fr/Splitter_Chi4.zip
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5614
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Exe including in splitter flickering when resize

Post by Kwai chang caine »

Yeees !!! this time it's the good (Finally i hope :oops:)
After several hours to try i have exactely what i want 8)
Exactely ...not really, because i believe i have breaking the nice toy that the kind CHI create for KCC :|
I don't understand why, but all is good exept the resizing of the splitters, who a new time... flickering a max :shock:
Yet i have not forgotten his splendid and magical line (That i not understand obviously :oops:)

Code: Select all

  SetWindowLongPtr_(ArrayAddon(MaxOnglets)\H_Cont, #GWL_STYLE, GetWindowLongPtr_(ArrayAddon(MaxOnglets)\H_Cont, #GWL_STYLE)|#WS_CLIPCHILDREN) ; <- important
If someone have an idea ...

The code and exes
https://prov.reec.fr/Splitter_Kcc_3.zip

Code: Select all

; https://www.purebasic.fr/english/viewtopic.php?p=649199#p649199 [CHI]
; https://www.purebasic.fr/english/viewtopic.php?p=45782#p45782 [Danilo]

Structure Addon
 Name.s
 Id_Run.i
 H_Addon.i
 Id_Cont.i
 H_Cont.i
EndStructure

Global Dim ArrayAddon.Addon(12)

Enumeration 100
 #FormProgram
 #SplitterV1
 #SplitterV2
 #SplitterH
EndEnumeration

ArrayAddon(1)\Name = "WindowBlue"
ArrayAddon(2)\Name = "WindowRed"
ArrayAddon(3)\Name = "WindowYellow"
ArrayAddon(4)\Name = "WindowBlue"
ArrayAddon(5)\Name = "WindowRed"
ArrayAddon(6)\Name = "WindowYellow"
ArrayAddon(7)\Name = "WindowBlue"
ArrayAddon(8)\Name = "WindowRed"
ArrayAddon(9)\Name = "WindowYellow"
ArrayAddon(10)\Name = "WindowBlue"
ArrayAddon(11)\Name = "WindowRed"
ArrayAddon(12)\Name = "WindowYellow"

Procedure WindowProc(hWnd,Msg,wParam,lParam)
 
 result = #PB_ProcessPureBasicEvents
 
 If Msg = #WM_SIZE 
  
  If hWnd = WindowID(#FormProgram) And IsGadget(#SplitterV1) And IsGadget(#SplitterV2) And IsGadget(#SplitterH)
   
   ; Adaptation des SPLITTERS au resizing de la fenetre
   ResizeGadget(#SplitterV1, 0, 0, lParam&$FFFF, (lParam>>16) & $FFFF)
   ResizeGadget(#SplitterV2, 0, 0, lParam& $ FFFF, (lParam>>16) & $FFFF)
   ResizeGadget(#SplitterH, 0, 0, lParam & $FFFF,(lParam>>16) & $FFFF)
   result = 0
   
  Else
   
   ; Adaptation des ADDONS au resizing des PANELS
   For c = 1 To 12
    
    If hWnd = ArrayAddon(c)\H_Cont And ArrayAddon(c)\H_Addon
    
     SetWindowPos_(ArrayAddon(c)\H_Addon, #HWND_TOP, 0, 0, GadgetWidth(ArrayAddon(c)\Id_Cont), GadgetHeight(ArrayAddon(c)\Id_Cont), #SWP_NOZORDER|#SWP_NOACTIVATE)
     result = 0
     
    EndIf
    
   Next
   
  EndIf 
  
 EndIf  
 
 ProcedureReturn result
 
EndProcedure

H_FormProgram = OpenWindow(#FormProgram,0,0, GetSystemMetrics_(#SM_CXSCREEN), GetSystemMetrics_(#SM_CYSCREEN),"Split",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_TitleBar|#PB_Window_Invisible)

For Panneau = 1000 To 1003
 
 PanelGadget(Panneau, 0, 0, WindowWidth(#FormProgram), WindowHeight(#FormProgram))

 For Onglet = 1 To 3
  
  MaxOnglets + 1   
  AddGadgetItem(Panneau, -1, ArrayAddon(MaxOnglets)\Name) 
  
  ; Create containers
  ArrayAddon(MaxOnglets)\Id_Cont = ContainerGadget(#PB_Any,0,0,WindowWidth(#FormProgram),WindowHeight(#FormProgram))
  CloseGadgetList()
  ArrayAddon(MaxOnglets)\H_Cont = GadgetID(ArrayAddon(MaxOnglets)\Id_Cont)
  SetWindowLongPtr_(ArrayAddon(MaxOnglets)\H_Cont, #GWL_STYLE, GetWindowLongPtr_(ArrayAddon(MaxOnglets)\H_Cont, #GWL_STYLE)|#WS_CLIPCHILDREN) ; <- important
  SetWindowLongPtr_(WindowID(#FormProgram), #GWL_STYLE, GetWindowLongPtr_(WindowID(#FormProgram), #GWL_STYLE)|#WS_CLIPCHILDREN)
    
  ; Insert executable
  ArrayAddon(MaxOnglets)\Id_Run = RunProgram(GetPathPart(ProgramFilename()) + "Addons\" + ArrayAddon(MaxOnglets)\Name + ".exe","",GetPathPart(ProgramFilename()), #PB_Program_Open|#PB_Program_Hide)
  Delay(10)
  
  If ArrayAddon(MaxOnglets)\Id_Run
   
   While ArrayAddon(MaxOnglets)\H_Addon = #Null
    
    ArrayAddon(MaxOnglets)\H_Addon = FindWindow_(0, ArrayAddon(MaxOnglets)\Name)
    WaitWindowEvent(1)
    
   Wend
   
   Delay(100)
   SetParent_(ArrayAddon(MaxOnglets)\H_Addon, ArrayAddon(MaxOnglets)\H_Cont)
   ShowWindow_(ArrayAddon(MaxOnglets)\H_Addon, #SW_NORMAL)
   
  EndIf
  
 Next
 
 CloseGadgetList()
 
Next   

; Splitter1 vertical (Gauche | Milieu)
SplitterGadget(#SplitterV1, 0, 0, WindowWidth(#FormProgram), WindowHeight(#FormProgram), 1000, 1001, #PB_Splitter_Vertical|#PB_Splitter_Separator)
SetGadgetState(#SplitterV1, WindowWidth(#FormProgram) / 4) ; Set splitter width

; Splitter2 vertical (Milieu | Droite)
SplitterGadget(#SplitterV2, 0, 0,WindowWidth(#FormProgram), WindowHeight(#FormProgram), #SplitterV1, 1002, #PB_Splitter_Vertical|#PB_Splitter_Separator)
SetGadgetState(#SplitterV2, WindowWidth(#FormProgram) - 200) ; Set splitter width

; Splitter3 horizontal (Splitter2 | Panneau bas)
SplitterGadget(#SplitterH, 0, 0,WindowWidth(#FormProgram),WindowHeight(#FormProgram), #SplitterV2, 1003, #PB_Splitter_Separator)
SetGadgetState(#SplitterH, WindowHeight(#FormProgram) - 200) ; Set splitter width

SetWindowCallback(@WindowProc())
ShowWindow_(H_FormProgram, #SW_MAXIMIZE)


Repeat
 Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow

For i = 1 To 12
 
 If IsProgram(ArrayAddon(i)\Id_Run)
  
  KillProgram(ArrayAddon(i)\Id_Run)
  CloseProgram(ArrayAddon(i)\Id_Run)
  
 EndIf
 
Next 
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
Post Reply