This is done at Runtime (see how To use below) by enumerating all PB Window And Object And building the Container-Child hierarchy.
The Attributes, Constants,... are then retrieved (See Inventories below)
And the List is then saved, Window by Window, to IceDesign format (*.icef)
You can now Design your PB Interface in IceDesign
Inventories:
- The Window(s) are recovered with their Sizes, Titles, BackColor, Constants and a Flag If there is a Menu.
- The Gadget(s) are recovered with their Positions And Sizes.
- The following attributes are retrieved:
- The Text of Buttons, CheckBox,... Minimum, Maximum, InnerWidth, InnerHeight, ColumnWidth, ScrollStep And PageLength
- Fonts, FrontColor, BackColor And ToolTip
- Status Disabled, Hidden
- And a large part of the Constants. See the List in the source file.
- ToolBar, StatusBar And Images are Not recovered.
- The Splitter is listed to browse the hierarchy. As it is Not supported by IceDesign, it is then removed and both child gadgets inherit the splitter's level and parent.
How To use:
- Include PBForm2IceDesign.pbi at the Beginning of your Source Code:
XIncludeFile "PBForm2IceDesign.pbi"
- After loading the Window(s) With Their Gadgets and Before the Event Loop, Call the Function:
PBForm2IceDesign() Or PBForm2IceDesign(#Window)
- Compile/Run (F5)
- Optional, Customize your IceDesign Form With the Following Constants:
- #UseShortNames = #True ; #True: Use Short Name for Controls (ex: #Btn) | #False: Use Long Name for Controls (ex: #Button)
- #RenameControlNames = #True ; Auto Rename the Controls Name Using the Caption Name. For Button, CheckBox and Option (ex: #Btn_CaptionName)
- #SetHiddenFlag = #False ; #False: No Gadgets are hidden | #True: it uses the same status (0/1) as in your Window
- #SetDisabledFlag = #False ; #False: No Gadgets are Disabled | #True: it uses the same status (0/1) as in your Window
Source Example:
Code: Select all
EnableExplicit
XIncludeFile "PBForm2IceDesign.pbi" ; <== Include PBForm2IceDesign.pbi source code
Enumeration Window
#Window_0
EndEnumeration
Enumeration Gadgets
#Button_1
EndEnumeration
Procedure Open_Window_0(X = 0, Y = 0, Width = 240, Height = 90)
If OpenWindow(#Window_0, X, Y, Width, Height, "Title", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(#Button_1, 20, 20, 200, 50, "Button_1")
EndIf
EndProcedure
Open_Window_0()
PBForm2IceDesign() ; <== Call the function PBForm2IceDesign() After Loading the Window(s) and Gadget(s) and Before the Event Loop
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
I was able to get the IceDesign interface saved in its own format
PBForm2IceDesign.pbi source is available in IceDesign Github
Copy-Paste Raw PBForm2IceDesign.pbi
.