IceDesign GUI designer

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
the.weavster
Addict
Addict
Posts: 1537
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Re: IceDesign (New) modern GUI designer

Post by the.weavster »

ChrisR wrote: Thu Sep 09, 2021 3:21 pm Add Anchors with Lock Top, Left, Bottom & Right checkboxes.
Thanks for implementing this :D
Another satisfied customer :wink:
firace
Addict
Addict
Posts: 899
Joined: Wed Nov 09, 2011 8:58 am

Re: IceDesign (New) modern GUI designer

Post by firace »

Thanks for the great updates!
I don't currently have a use for IceDesign, but I'm sure I will soon, and am glad I bought a copy of this powerful and well-designed tool!
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: IceDesign (New) modern GUI designer

Post by Caronte3D »

Hi Chris!

I know you prefer to use dialogs for this kind of resize, but I thik would be a nice addition to your GUI Designer.

I tested a symple example so you can see what I mean:


Thi's the original code from IceDesign:

Code: Select all

; -----------------------------------------------------------------------------
;           Name:
;    Description:
;         Author:
;           Date: 2021-09-11
;        Version:
;     PB-Version:
;             OS:
;         Credit:
;          Forum:
;     Created by: IceDesign
; -----------------------------------------------------------------------------

EnableExplicit

;- Enumerations
Enumeration Window
  #Window_0
EndEnumeration

Enumeration Gadgets
  #Btn_1
  #Btn_1_3
  #Btn_1_1
  #Btn_1_1_1
  #Btn_1_2
  #Btn_1_2_1
EndEnumeration

;- Declare
Declare Resize_Window_0()
Declare Open_Window_0(X = 0, Y = 0, Width = 290, Height = 190)

Procedure Resize_Window_0()
  ResizeGadget(#Btn_1, 10, 10, WindowWidth(#Window_0) - 160, WindowHeight(#Window_0) - 140)
  ResizeGadget(#Btn_1_3, 150, 10, WindowWidth(#Window_0) - 160, WindowHeight(#Window_0) - 140)
  ResizeGadget(#Btn_1_1, 10, 70, WindowWidth(#Window_0) - 160, WindowHeight(#Window_0) - 140)
  ResizeGadget(#Btn_1_1_1, 150, 70, WindowWidth(#Window_0) - 160, WindowHeight(#Window_0) - 140)
  ResizeGadget(#Btn_1_2, 10, 130, WindowWidth(#Window_0) - 160, WindowHeight(#Window_0) - 140)
  ResizeGadget(#Btn_1_2_1, 150, 130, WindowWidth(#Window_0) - 160, WindowHeight(#Window_0) - 140)
EndProcedure

Procedure Open_Window_0(X = 0, Y = 0, Width = 290, Height = 190)
  If OpenWindow(#Window_0, X, Y, Width, Height, "Title", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
    ButtonGadget(#Btn_1, 10, 10, 130, 50, "Button_1")
    ButtonGadget(#Btn_1_3, 150, 10, 130, 50, "Button_1")
    ButtonGadget(#Btn_1_1, 10, 70, 130, 50, "Button_1")
    ButtonGadget(#Btn_1_1_1, 150, 70, 130, 50, "Button_1")
    ButtonGadget(#Btn_1_2, 10, 130, 130, 50, "Button_1")
    ButtonGadget(#Btn_1_2_1, 150, 130, 130, 50, "Button_1")

    BindEvent(#PB_Event_SizeWindow, @Resize_Window_0(), #Window_0)
  EndIf
EndProcedure

;- Main Program
Open_Window_0()

;- Event Loop
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break

      ;-> Event Gadget
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #Btn_1   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_3   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_3" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_1   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_1_1   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_1_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_2   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_2" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_2_1   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_2_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
      EndSelect

  EndSelect
ForEver
And... Thi's a modified (dirty) one to get the nice proportional scaling:

Code: Select all

; -----------------------------------------------------------------------------
;           Name:
;    Description:
;         Author:
;           Date: 2021-09-11
;        Version:
;     PB-Version:
;             OS:
;         Credit:
;          Forum:
;     Created by: IceDesign
; -----------------------------------------------------------------------------

EnableExplicit

;- Enumerations
Enumeration Window
  #Window_0
EndEnumeration

Enumeration Gadgets
  #Btn_1
  #Btn_1_3
  #Btn_1_1
  #Btn_1_1_1
  #Btn_1_2
  #Btn_1_2_1
EndEnumeration

Global winWidthIni,winHeightIni

;- Declare
Declare Resize_Window_0()
Declare Open_Window_0(X = 0, Y = 0, Width = 290, Height = 190)

Procedure.d getPorcentFromCoordX(x.d = 0.00)
  ProcedureReturn (x.d*100)/winWidthIni
EndProcedure
Procedure.d getCoordXFromPorcent(Porcent.d = 0.00)
  ProcedureReturn WindowWidth(#Window_0)*(porcent/100)
EndProcedure

Procedure.d getPorcentFromCoordY(y.d = 0.00)
  ProcedureReturn (y.d*100)/winHeightIni
EndProcedure
Procedure.d getCoordYFromPorcent(Porcent.d = 0.00)
  ProcedureReturn WindowHeight(#Window_0)*(porcent/100)
EndProcedure

Procedure Resize_Window_0()
  
  ResizeGadget(#Btn_1, getCoordXFromPorcent(getPorcentFromCoordX(10)), getCoordYFromPorcent(getPorcentFromCoordY(10)), getCoordXFromPorcent(getPorcentFromCoordX((winWidthIni - 160))), getCoordYFromPorcent(getPorcentFromCoordY((winHeightIni - 140))))
  ResizeGadget(#Btn_1_3, getCoordXFromPorcent(getPorcentFromCoordX(150)), getCoordYFromPorcent(getPorcentFromCoordY(10)), getCoordXFromPorcent(getPorcentFromCoordX((winWidthIni - 160))), getCoordYFromPorcent(getPorcentFromCoordY((winHeightIni - 140))))
  
  ResizeGadget(#Btn_1_1, getCoordXFromPorcent(getPorcentFromCoordX(10)), getCoordYFromPorcent(getPorcentFromCoordY(70)), getCoordXFromPorcent(getPorcentFromCoordX((winWidthIni - 160))), getCoordYFromPorcent(getPorcentFromCoordY((winHeightIni - 140))))
  ResizeGadget(#Btn_1_1_1, getCoordXFromPorcent(getPorcentFromCoordX(150)), getCoordYFromPorcent(getPorcentFromCoordY(70)), getCoordXFromPorcent(getPorcentFromCoordX((winWidthIni - 160))), getCoordYFromPorcent(getPorcentFromCoordY((winHeightIni - 140))))
  
  ResizeGadget(#Btn_1_2, getCoordXFromPorcent(getPorcentFromCoordX(10)), getCoordYFromPorcent(getPorcentFromCoordY(130)), getCoordXFromPorcent(getPorcentFromCoordX((winWidthIni - 160))), getCoordYFromPorcent(getPorcentFromCoordY((winHeightIni - 140))))
  ResizeGadget(#Btn_1_2_1, getCoordXFromPorcent(getPorcentFromCoordX(150)), getCoordYFromPorcent(getPorcentFromCoordY(130)), getCoordXFromPorcent(getPorcentFromCoordX((winWidthIni - 160))), getCoordYFromPorcent(getPorcentFromCoordY((winHeightIni - 140))))
  
EndProcedure

Procedure Open_Window_0(X = 0, Y = 0, Width = 290, Height = 190)
  If OpenWindow(#Window_0, X, Y, Width, Height, "Title", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
    ButtonGadget(#Btn_1, 10, 10, 130, 50, "Button_1")
    ButtonGadget(#Btn_1_3, 150, 10, 130, 50, "Button_1")
    ButtonGadget(#Btn_1_1, 10, 70, 130, 50, "Button_1")
    ButtonGadget(#Btn_1_1_1, 150, 70, 130, 50, "Button_1")
    ButtonGadget(#Btn_1_2, 10, 130, 130, 50, "Button_1")
    ButtonGadget(#Btn_1_2_1, 150, 130, 130, 50, "Button_1")
    
    winWidthIni=WindowWidth(#Window_0)
    winHeightIni=WindowHeight(#Window_0)
    
    BindEvent(#PB_Event_SizeWindow, @Resize_Window_0(), #Window_0)
  EndIf
EndProcedure

;- Main Program
Open_Window_0()

;- Event Loop
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break

      ;-> Event Gadget
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #Btn_1   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_3   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_3" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_1   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_1_1   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_1_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_2   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_2" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_2_1   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_2_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
      EndSelect

  EndSelect
ForEver
Result:
Image
Image
User avatar
ChrisR
Addict
Addict
Posts: 1127
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign (New) modern GUI designer

Post by ChrisR »

Thanks for all the kind words :)

@Caronte3D it looks nice, i'm in weekend for 3 days so I will look at your code from Tuesday.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: IceDesign (New) modern GUI designer

Post by Rinzwind »

Just a thought. Add a BindGadgetEvent option that creates the event procedure for the selected gadget together with checkboxes to select which EventTypes to handle (creates switch statement) or something like that.
User avatar
ChrisR
Addict
Addict
Posts: 1127
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign (New) modern GUI designer

Post by ChrisR »

Hi Caronte3D,
Caronte3D wrote: Fri Sep 10, 2021 11:42 pm I know you prefer to use dialogs for this kind of resize, but I thik would be a nice addition to your GUI Designer.
It's interesting, I'll add it.
I will probably add an additional CheckBox "Proportional Resizing" at the bottom of the Anchor properties section.
If enabled, it would take priority over Lock Left, Right, Top & Bottom ! with a code like this:

Code: Select all

; -----------------------------------------------------------------------------
;           Name:
;    Description:
;         Author:
;           Date: 2021-09-14
;        Version:
;     PB-Version:
;             OS:
;         Credit:
;          Forum:
;     Created by: IceDesign
; -----------------------------------------------------------------------------

EnableExplicit

;- Enumerations
Enumeration Window
  #Window_0
EndEnumeration

Enumeration Gadgets
  #Btn_Button_1
  #Btn_Button_4
  #Btn_Button_2
  #Btn_Button_5
  #Btn_Button_3
  #Btn_Button_6
EndEnumeration

;- Declare
Declare PropFactorX(X = 0)
Declare PropFactorY(Y = 0)  
Declare Resize_Window_0()
Declare Open_Window_0(X = 0, Y = 0, Width = 290, Height = 190)

Global WinWidthIni, WinHeightIni

Procedure PropFactorX(X = 0)
  ProcedureReturn Round(WindowWidth(#Window_0) * X / WinWidthIni, #PB_Round_Nearest)
EndProcedure

Procedure PropFactorY(Y = 0)
  ProcedureReturn Round(WindowHeight(#Window_0) * Y / WinHeightIni, #PB_Round_Nearest)
EndProcedure

Procedure Resize_Window_0()
  ResizeGadget(#Btn_Button_1, PropFactorX(10), PropFactorY(10), PropFactorX(WinWidthIni - 160), PropFactorY(WinHeightIni - 140))
  ResizeGadget(#Btn_Button_4, PropFactorX(150), PropFactorY(10), PropFactorX(WinWidthIni - 160), PropFactorY(WinHeightIni - 140))
  ResizeGadget(#Btn_Button_2, PropFactorX(10), PropFactorY(70), PropFactorX(WinWidthIni - 160), PropFactorY(WinHeightIni - 140))
  ResizeGadget(#Btn_Button_5, PropFactorX(150), PropFactorY(70), PropFactorX(WinWidthIni - 160), PropFactorY(WinHeightIni - 140))
  ResizeGadget(#Btn_Button_3, PropFactorX(10), PropFactorY(130), PropFactorX(WinWidthIni - 160), PropFactorY(WinHeightIni - 140))
  ResizeGadget(#Btn_Button_6, PropFactorX(150), PropFactorY(130), PropFactorX(WinWidthIni - 160), PropFactorY(WinHeightIni - 140))
EndProcedure

Procedure Open_Window_0(X = 0, Y = 0, Width = 290, Height = 190)
  If OpenWindow(#Window_0, X, Y, Width, Height, "Title", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
    ButtonGadget(#Btn_Button_1, 10, 10, 130, 50, "Button_1")
    ButtonGadget(#Btn_Button_4, 150, 10, 130, 50, "Button_4")
    ButtonGadget(#Btn_Button_2, 10, 70, 130, 50, "Button_2")
    ButtonGadget(#Btn_Button_5, 150, 70, 130, 50, "Button_5")
    ButtonGadget(#Btn_Button_3, 10, 130, 130, 50, "Button_3")
    ButtonGadget(#Btn_Button_6, 150, 130, 130, 50, "Button_6")
    
    WinWidthIni  = WindowWidth(#Window_0)
    WinHeightIni = WindowHeight(#Window_0)
    
    BindEvent(#PB_Event_SizeWindow, @Resize_Window_0(), #Window_0)
  EndIf
EndProcedure

;- Main Program
Open_Window_0()

;- Event Loop
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break

      ;-> Event Gadget
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #Btn_Button_1   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_Button_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_Button_4   ; Button_4
          MessageRequester("Information", "Button Name : #Btn_Button_4" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_Button_2   ; Button_2
          MessageRequester("Information", "Button Name : #Btn_Button_2" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_Button_5   ; Button_5
          MessageRequester("Information", "Button Name : #Btn_Button_5" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_Button_3   ; Button_3
          MessageRequester("Information", "Button Name : #Btn_Button_3" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_Button_6   ; Button_6
          MessageRequester("Information", "Button Name : #Btn_Button_6" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
      EndSelect

  EndSelect
ForEver
Last edited by ChrisR on Tue Sep 14, 2021 6:07 pm, edited 1 time in total.
User avatar
ChrisR
Addict
Addict
Posts: 1127
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign (New) modern GUI designer

Post by ChrisR »

Rinzwind wrote: Mon Sep 13, 2021 2:56 am Just a thought. Add a BindGadgetEvent option that creates the event procedure for the selected gadget together with checkboxes to select which EventTypes to handle (creates switch statement) or something like that.
Yes, BindGadgetEvent is on my todo, probably with a combo, to not overload the properties and thus with a simple choice #PB_All or only one EventType()
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: IceDesign (New) modern GUI designer

Post by Caronte3D »

ChrisR wrote: Tue Sep 14, 2021 5:49 pm It's interesting, I'll add it.
Perfect! Thanks! :wink:
User avatar
ChrisR
Addict
Addict
Posts: 1127
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign (New) modern GUI designer

Post by ChrisR »

IceDesign has been updated in version 1.2.4

New features:
Proportional resize:
Add a "Proportional" property option in the Anchor section.
When resizing the window, gadget(s) will automatically be resized proportionally.

BindGadgetEvent:
Add a "BindGadget" property option in the Miscellaneous section.
And add an option "Enable BindGadget by Default" in the settings to manage the default value of this property for the next added gadgets.
All Event Types are Binded. There would be too many possibilities otherwise, such as procedures for each EventType()...
The Event procedure "Event_(ControlName)" will be written in the generated code.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: IceDesign (New) modern GUI designer

Post by Rinzwind »

I'm pleasantly surprised at the progress of this and it actually works way better than the default PB one. Thanks.

Btw I still prefer it to be DPI aware by default as 4K user. Sharpness is king. It works fine in non-extreme cases (same as PB itself, whose toolbar icons still don't resize properly). It helps probably that the actual form designer window is still displayed at 100% in any case, but that is fine with me for now.
User avatar
ChrisR
Addict
Addict
Posts: 1127
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign (New) modern GUI designer

Post by ChrisR »

Rinzwind wrote: Fri Sep 17, 2021 2:32 am I'm pleasantly surprised at the progress of this and it actually works way better than the default PB one. Thanks.

Btw I still prefer it to be DPI aware by default as 4K user.
Thanks and OK, I've heard

IceDesign has been updated in version 1.2.5

Run IceDesign with DPI parameter to create IceDesign_DPI.exe with the DpiAware manifest. The display will be with 100% scaling, but it will be probably sharper for 4K or other screens.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: IceDesign (New) modern GUI designer

Post by Rinzwind »

The display will be with 100% scaling
To clarify: the controls scale mostly fine ands sharp using the Window scale setting, except the form designer element which stays at 100% (and that way still generates same code for control position/sizes) and the icons at top.
Thanks!

Run it as IceDesign.exe DPI (case sensitive parameter?)
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: IceDesign (New) modern GUI designer

Post by Caronte3D »

Proportional doesn't work on this version or I'm missing something? :?

EDIT:
The problem was you forget to use WinWidthIni and WinHeightIni on the size, simply replace the: "WindowWidth(#Window_0)" and "WindowHeight(#Window_0)" on the size parameter :wink:
User avatar
ChrisR
Addict
Addict
Posts: 1127
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: IceDesign (New) modern GUI designer

Post by ChrisR »

Oops, it should be fixed now.
Thanks for reporting :)
Rinzwind wrote: Sat Sep 18, 2021 6:52 am Run it as IceDesign.exe DPI (case sensitive parameter?)
The Dpi parameter is case insensitive now :wink:

Version 1.2.6 is online.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: IceDesign (New) modern GUI designer

Post by Caronte3D »

Hi!
Proportional doesn't work with containers, (I mean gadgets inside) to solve it, you can use the initial position of the container instead of the window it self.

Maybe a combobox with all the gadgets on the window would be perfect to select the parent of the proportional mode, so we can use it even without a container?
Take a look, please:

On this example you can see at the left side the corrected code and the actual (incorrect) at the right side.

Code: Select all

; -----------------------------------------------------------------------------
;           Name:
;    Description:
;         Author:
;           Date: 2021-09-19
;        Version:
;     PB-Version:
;             OS:
;         Credit:
;          Forum:
;     Created by: IceDesign
; -----------------------------------------------------------------------------

EnableExplicit

;- Enumerations
Enumeration Window
  #Window_0
EndEnumeration

Enumeration Gadgets
  #Cont_1
  #Btn_1
  #Btn_1_1
  #Btn_1_2
  #Cont_1_1
  #Btn_1_3
  #Btn_1_1_1
  #Btn_1_2_1
EndEnumeration

;- Declare
Declare PropFactorX(X = 0)
Declare PropFactorY(Y = 0)
Declare Resize_Window_0()
Declare Open_Window_0(X = 0, Y = 0, Width = 630, Height = 360)

Global WinWidthIni, WinHeightIni
Global ContainerWidth_1, ContainerHeight_1 ; NEW TEST

Procedure PropFactorX(X = 0)
  ProcedureReturn Round(WindowWidth(#Window_0) * X / WinWidthIni, #PB_Round_Nearest)
EndProcedure

Procedure PropFactorY(Y = 0)
  ProcedureReturn Round(WindowHeight(#Window_0) * Y / WinHeightIni, #PB_Round_Nearest)
EndProcedure

Procedure Resize_Window_0()
  ResizeGadget(#Cont_1, PropFactorX(10), PropFactorY(10), PropFactorX(WinWidthIni - 330), PropFactorY(WinHeightIni - 100))
  ResizeGadget(#Btn_1, PropFactorX(10), PropFactorY(10), PropFactorX(ContainerWidth_1 - 220), PropFactorY(ContainerHeight_1 - 230)) ; NEW TEST
  ResizeGadget(#Btn_1_1, PropFactorX(105), PropFactorY(10), PropFactorX(ContainerWidth_1 - 220), PropFactorY(ContainerHeight_1 - 230)) ; NEW TEST
  ResizeGadget(#Btn_1_2, PropFactorX(200), PropFactorY(10), PropFactorX(ContainerWidth_1 - 220), PropFactorY(ContainerHeight_1 - 230)) ; NEW TEST
  
  ResizeGadget(#Cont_1_1, PropFactorX(320), PropFactorY(10), PropFactorX(WinWidthIni - 330), PropFactorY(WinHeightIni - 100))
  ResizeGadget(#Btn_1_3, PropFactorX(10), PropFactorY(10), PropFactorX(WinWidthIni - 220), PropFactorY(WinHeightIni - 230))
  ResizeGadget(#Btn_1_1_1, PropFactorX(110), PropFactorY(10), PropFactorX(WinWidthIni - 220), PropFactorY(WinHeightIni - 230))
  ResizeGadget(#Btn_1_2_1, PropFactorX(200), PropFactorY(10), PropFactorX(WinWidthIni - 220), PropFactorY(WinHeightIni - 230))
EndProcedure

Procedure Open_Window_0(X = 0, Y = 0, Width = 630, Height = 360)
  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, 10, 10, 300, 260, #PB_Container_Raised)
      ButtonGadget(#Btn_1, 10, 10, 80, 30, "Button_1")
      ButtonGadget(#Btn_1_1, 105, 10, 80, 30, "Button_1")
      ButtonGadget(#Btn_1_2, 200, 10, 80, 30, "Button_1")
    CloseGadgetList()   ; #Cont_1
    ContainerGadget(#Cont_1_1, 320, 10, 300, 260, #PB_Container_Raised)
      ButtonGadget(#Btn_1_3, 10, 10, 80, 30, "Button_1")
      ButtonGadget(#Btn_1_1_1, 110, 10, 80, 30, "Button_1")
      ButtonGadget(#Btn_1_2_1, 200, 10, 80, 30, "Button_1")
    CloseGadgetList()   ; #Cont_1_1

    WinWidthIni   = WindowWidth(#Window_0)
    WinHeightIni  = WindowHeight(#Window_0)
    ContainerWidth_1    = GadgetWidth(#Cont_1) ; NEW TEST
    ContainerHeight_1    = GadgetHeight(#Cont_1) ; NEW TEST
    
    BindEvent(#PB_Event_SizeWindow, @Resize_Window_0(), #Window_0)
  EndIf
EndProcedure

;- Main Program
Open_Window_0()

;- Event Loop
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break

      ;-> Event Gadget
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #Btn_1   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_1   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_2   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_2" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_3   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_3" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_1_1   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_1_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
        Case #Btn_1_2_1   ; Button_1
          MessageRequester("Information", "Button Name : #Btn_1_2_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
      EndSelect

  EndSelect
ForEver
EDIT:
Another feature request is to limit the size of the window when the user scale it, something like on this forum thread:
viewtopic.php?f=13&t=21869

Thanks! :wink:
Post Reply