Hi guys, I have a few questions and tried searching it up in the forum.
1. How do I openWindow (parent) and then have all the child inside the parent window and maximize/minimize accordingly? The current open window seems to allow the child window to roam freely outside the boundaries of the parent window.
2. Is there a way to make a form in the IDE and then make that as a template? I guess you can call it multiple times openwindow and it should just take it as it is.
3. OK then how do I reference that particular window and then create gadgets dynamically in there specifically for that opened window?
Thanks. And apologies if it's somewhere in the forums already.
Window in a window
Re: Window in a window
Do you mean the MDI Gadget:
Code: Select all
Enumeration
#Window_Main
#Window_Child1
#Window_Child2
EndEnumeration
Enumeration
#Menu_Main
EndEnumeration
Enumeration
#Gadget_ChildWindows
EndEnumeration
OpenWindow(#Window_Main, 0, 0, 400, 300, "MDIGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget)
CreateMenu(#Menu_Main, WindowID(#Window_Main))
MenuTitle("Child Windows")
MDIGadget(#Gadget_ChildWindows, 0, 0, 0, 0, 0, 0, #PB_MDI_AutoSize)
AddGadgetItem(#Gadget_ChildWindows, #Window_Child1, "child window 1")
AddGadgetItem(#Gadget_ChildWindows, #Window_Child2, "child window 2")
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
-
- User
- Posts: 65
- Joined: Tue Feb 11, 2020 7:50 am
Re: Window in a window
Hi thanks for the reply. Tried the code out and yes, the child windows were created. I tried to put a button on a specific child but I think I got it wrong. What I did was below but it kinda overwrote the children.
Code: Select all
UseGadgetList(WindowID(#Window_Child2))
ButtonGadget(#Button1, 10, 10, 150, 25, "Child Window Button")
STARGÅTE wrote: ↑Tue Nov 22, 2022 11:40 am Do you mean the MDI Gadget:
Code: Select all
Enumeration #Window_Main #Window_Child1 #Window_Child2 EndEnumeration Enumeration #Menu_Main EndEnumeration Enumeration #Gadget_ChildWindows EndEnumeration OpenWindow(#Window_Main, 0, 0, 400, 300, "MDIGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget) CreateMenu(#Menu_Main, WindowID(#Window_Main)) MenuTitle("Child Windows") MDIGadget(#Gadget_ChildWindows, 0, 0, 0, 0, 0, 0, #PB_MDI_AutoSize) AddGadgetItem(#Gadget_ChildWindows, #Window_Child1, "child window 1") AddGadgetItem(#Gadget_ChildWindows, #Window_Child2, "child window 2") Repeat Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: Window in a window
Code: Select all
Enumeration
#Window_Main
#Window_Child1
#Window_Child2
EndEnumeration
Enumeration
#Menu_Main
EndEnumeration
Enumeration
#Gadget_ChildWindows
#Button1
#Button2
EndEnumeration
OpenWindow(#Window_Main, 0, 0, 400, 300, "MDIGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget)
CreateMenu(#Menu_Main, WindowID(#Window_Main))
MenuTitle("Child Windows")
MDIGadget(#Gadget_ChildWindows, 0, 0, 0, 0, 0, 0, #PB_MDI_AutoSize)
AddGadgetItem(#Gadget_ChildWindows, #Window_Child1, "child window 1")
AddGadgetItem(#Gadget_ChildWindows, #Window_Child2, "child window 2")
UseGadgetList(WindowID(#Window_Child1))
ButtonGadget(#Button1, 10, 10, 150, 25, "Child Window Button")
UseGadgetList(WindowID(#Window_Child2))
ButtonGadget(#Button2, 10, 10, 150, 25, "Child Window Button")
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
-
- User
- Posts: 65
- Joined: Tue Feb 11, 2020 7:50 am
Re: Window in a window
Thank you for your patience and example code. Appreciate it.
-
- New User
- Posts: 9
- Joined: Fri Nov 27, 2015 4:53 pm
Re: Window in a window
Is there a way to use #PB_Event_CloseWindow to close a child window and not close all the windows?
Re: Window in a window
Happy holidays!
You can use EventWindow() to see which window an event belongs to.
If you want child windows to be closeable with the close event, then you can just do
You can use EventWindow() to see which window an event belongs to.
Code: Select all
Enumeration
#Window_Main
#Window_Child1
#Window_Child2
EndEnumeration
Enumeration
#Menu_Main
EndEnumeration
Enumeration
#Gadget_ChildWindows
#Button1
#Button2
EndEnumeration
OpenWindow(#Window_Main, 0, 0, 400, 300, "MDIGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget)
CreateMenu(#Menu_Main, WindowID(#Window_Main))
MenuTitle("Child Windows")
MDIGadget(#Gadget_ChildWindows, 0, 0, 0, 0, 0, 0, #PB_MDI_AutoSize)
AddGadgetItem(#Gadget_ChildWindows, #Window_Child1, "child window 1")
AddGadgetItem(#Gadget_ChildWindows, #Window_Child2, "child window 2")
UseGadgetList(WindowID(#Window_Child1))
ButtonGadget(#Button1, 10, 10, 150, 25, "Child Window Button")
UseGadgetList(WindowID(#Window_Child2))
ButtonGadget(#Button2, 10, 10, 150, 25, "Child Window Button")
Repeat
e=WaitWindowEvent()
If e<>#PB_Event_CloseWindow
Continue
EndIf
w=EventWindow()
If w=#Window_Main
End
EndIf
CloseWindow(w)
ForEver
Code: Select all
e=WaitWindowEvent()
If e<>#PB_Event_CloseWindow
Continue
EndIf
w=GetGadgetState(#Gadget_ChildWindows)
If w=-1; no child windows focused, assume the main one
End
EndIf
CloseWindow(w)
ForEver