Re: IceDesign GUI designer
Posted: Tue Jan 10, 2023 3:09 am
I made a small update, to fix an indentation problem I didn't have before, a required line deleted by mistake during last cleanup.
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
CatchImage(#Imag_0, ?Imag_0)
DataSection
Imag_0: : IncludeBinary "D:\Users\ChrisR\Pictures\PureBasic.bmp"
EndDataSection
Now, that's what I wanted to hear! I will try it out as soon as possible! Thx!ChrisR wrote: Tue Jan 17, 2023 5:25 pm Hi jacdelad,
The option to load an image from the DataSection is already here at the bottom of the settings.
With the following generated code (Not with Bin2Data):
Code: Select all
CatchImage(#Imag_0, ?Imag_0) DataSection Imag_0: : IncludeBinary "D:\Users\ChrisR\Pictures\PureBasic.bmp" EndDataSection
Code: Select all
EnableExplicit
Enumeration Window
#Window_0
EndEnumeration
Enumeration Gadgets
#Cont_1
#Btn_Prop_X_1
#Btn_Prop_X_2
#Btn_Prop_X_3
#Btn_Prop_X_Width_1
#Btn_Prop_X_Width_2
#Btn_Prop_X_Width_3
EndEnumeration
Declare Resize_Window_0()
Declare Open_Window_0(X = 0, Y = 0, Width = 600, Height = 260)
Procedure Resize_Window_0()
Protected ScaleX.f, ScaleY.f, Width, Height
Static Window_0_WidthIni, Window_0_HeightIni
Static Cont_1_WidthIni, Cont_1_HeightIni
If Window_0_WidthIni = 0
Window_0_WidthIni = WindowWidth(#Window_0) : Window_0_HeightIni = WindowHeight(#Window_0)
Cont_1_WidthIni = GadgetWidth(#Cont_1) : Cont_1_HeightIni = GadgetHeight(#Cont_1)
EndIf
ScaleX = WindowWidth(#Window_0) / Window_0_WidthIni : ScaleY = WindowHeight(#Window_0) / Window_0_HeightIni
Width = ScaleX * (Window_0_WidthIni - 40) : Height = ScaleY * (Window_0_HeightIni - 40)
ResizeGadget(#Cont_1, ScaleX * 20, ScaleY * 20, Width, Height)
ScaleX = GadgetWidth(#Cont_1) / Cont_1_WidthIni : ScaleY = GadgetHeight(#Cont_1) / Cont_1_HeightIni
ResizeGadget(#Btn_Prop_X_1, ScaleX * (20 + 80) - 80, ScaleY * (20 + 40) - 40, 160, 80)
ResizeGadget(#Btn_Prop_X_2, ScaleX * (200 + 80) - 80, ScaleY * (20 + 40) - 40, 160, 80)
ResizeGadget(#Btn_Prop_X_3, ScaleX * (380 + 80) - 80, ScaleY * (20 + 40) - 40, 160, 80)
Width = ScaleX * (Cont_1_WidthIni - 400) : Height = ScaleY * (Cont_1_HeightIni - 140)
ResizeGadget(#Btn_Prop_X_Width_1, ScaleX * 20, ScaleY * 120, Width, Height)
Width = ScaleX * (Cont_1_WidthIni - 400) : Height = ScaleY * (Cont_1_HeightIni - 140)
ResizeGadget(#Btn_Prop_X_Width_2, ScaleX * 200, ScaleY * 120, Width, Height)
Width = ScaleX * (Cont_1_WidthIni - 400) : Height = ScaleY * (Cont_1_HeightIni - 140)
ResizeGadget(#Btn_Prop_X_Width_3, ScaleX * 380, ScaleY * 120, Width, Height)
EndProcedure
Procedure Open_Window_0(X = 0, Y = 0, Width = 600, Height = 260)
If OpenWindow(#Window_0, X, Y, Width, Height, "Title", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
ContainerGadget(#Cont_1, 20, 20, 560, 220, #PB_Container_Flat)
ButtonGadget(#Btn_Prop_X_1, 20, 20, 160, 80, "Prop_X_1")
ButtonGadget(#Btn_Prop_X_2, 200, 20, 160, 80, "Prop_X_2")
ButtonGadget(#Btn_Prop_X_3, 380, 20, 160, 80, "Prop_X_3")
ButtonGadget(#Btn_Prop_X_Width_1, 20, 120, 160, 80, "Prop_X_Width_1")
ButtonGadget(#Btn_Prop_X_Width_2, 200, 120, 160, 80, "Prop_X_Width_2")
ButtonGadget(#Btn_Prop_X_Width_3, 380, 120, 160, 80, "Prop_X_Width_3")
CloseGadgetList() ; #Cont_1
BindEvent(#PB_Event_SizeWindow, @Resize_Window_0(), #Window_0)
PostEvent(#PB_Event_SizeWindow, #Window_0, 0)
EndIf
EndProcedure
Open_Window_0()
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow