Dear @Paul.
Would it be possible to add the automatic resizing function to the SpiderBasic export module, as it is in PB (PVDynamics_Resize()), or would this not be feasible in general due to the differences between SpiderBasic and PB?
Code: Select all
;- meta
EnableExplicit
#AppName = "Lists"
#Title = "3 Lists Example"
Enumeration
#Window
#Text_Title
#Font_Title
#List_A
#List_B
#List_C
#Font_Lists
EndEnumeration
;- settings
Global vspacer.f = 2.5 ; percentage of vertical space between gadgets
Global hspacer.f = 3 ; percentage of horizontal space between gadgets
Global titleHeight.f = 3 ; percentage of screen height for the title
; colors
Define bgColor = $333333
Define listAcolor = $CDD939
Define listBcolor = $253FF0
Define listCcolor = $05ACF7
Procedure resize()
; calculate spacings of gadgets, change it in the settings
Protected hspace = WindowWidth(#Window) * hspacer * 0.01
Protected vspace = WindowHeight(#Window) * vspacer * 0.01
; title
Protected txtHeight = WindowHeight(#Window) * titleHeight * 0.01
ResizeGadget(#Text_Title, hspace, vspace, WindowWidth(#Window) - 2 * hspace, WindowHeight(#Window) - 3 * vspace)
LoadFont(#Font_Title, "Arial", txtHeight, #PB_Font_Bold)
SetGadgetFont(#Text_Title, FontID(#Font_Title))
; lists
Protected listWidth = (WindowWidth(#Window) - 4 * hspace) / 3
Protected listHeight = WindowHeight(#Window) - 3 * vspace - txtHeight
ResizeGadget(#List_A, hspace, 2 * vspace + txtHeight, listWidth, listHeight)
ResizeGadget(#List_B, hspace * 2 + listWidth, 2 * vspace + txtHeight, listWidth, listHeight)
ResizeGadget(#List_C, hspace * 3 + 2 * listWidth, 2 * vspace + txtHeight, listWidth, listHeight)
LoadFont(#Font_Lists, "Arial", txtHeight * 0.6)
SetGadgetFont(#List_A, FontID(#Font_Lists))
SetGadgetFont(#List_B, FontID(#Font_Lists))
SetGadgetFont(#List_C, FontID(#Font_Lists))
EndProcedure
;- ui
OpenWindow(#Window, 0, 0, 10, 10, #AppName, #PB_Window_Background)
SetWindowColor(#Window, bgColor)
TextGadget(#Text_Title, 0, 0, 0, 0, #Title)
SetGadgetColor(#Text_Title, #PB_Gadget_FrontColor, #White)
ListViewGadget(#List_A, 0, 0, 0, 0, #PB_ListView_ClickSelect)
SetGadgetColor(#List_A, #PB_Gadget_BackColor, $39D9CD)
ListViewGadget(#List_B, 0, 0, 0, 0, #PB_ListView_ClickSelect)
SetGadgetColor(#List_B, #PB_Gadget_BackColor, $253FF0)
ListViewGadget(#List_C, 0, 0, 0, 0, #PB_ListView_ClickSelect)
SetGadgetColor(#List_C, #PB_Gadget_BackColor, $05ACF7)
BindEvent(#PB_Event_SizeWindow, @Resize())
resize()
;- sample data
Define i
; Let's fill List-A
For i = 0 To 30
AddGadgetItem(#List_A, -1, "Item A."+Str(i))
Next
; Let's fill List-B
For i = 0 To 8
AddGadgetItem(#List_B, -1, "Item B."+Str(i))
Next
For i = 0 To 50
AddGadgetItem(#List_C, -1, "Item C."+Str(i))
Next