Thanks for implementing this
Another satisfied customer
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
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
It's interesting, I'll add it.
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
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()
Thanks and OK, I've heard
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.The display will be with 100% scaling
The Dpi parameter is case insensitive now
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