Hi,
Does anyone know how to manage on-the-fly the dimensions of a ScrollAreaGadget created using the DialogXML lib?
This ScrollAreaGadget can contain from one to several thousand ImageGadgets, which can be added or deleted on the fly.
Thanks.
[SOLVED] ScrollAreaGadget and DialogXML
[SOLVED] ScrollAreaGadget and DialogXML
Last edited by boddhi on Mon Jan 08, 2024 10:07 pm, edited 1 time in total.
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Except on this sentence...
Re: ScrollAreaGadget and DialogXML
You can change the internal dimensions using SetGadgetAttribute just as usual. The trick is obtaining the right gadget number. You can either use Runtime constants to specify gadget numbers, see the Multibox example in the OpenXMLDialog help article. Or you can use the 'name' attribute and use DialogGadget to obtain a number at runtime:
Code: Select all
#Dialog = 0
#Xml = 0
Runtime Procedure OnButton1Event()
Define.i Scroll1, W, H
Scroll1 = DialogGadget(#Dialog, "Scroll1")
W = GetGadgetAttribute(Scroll1, #PB_ScrollArea_InnerWidth)
H = GetGadgetAttribute(Scroll1, #PB_ScrollArea_InnerHeight)
W + 200
H + 200
SetGadgetAttribute(Scroll1, #PB_ScrollArea_InnerWidth, W)
SetGadgetAttribute(Scroll1, #PB_ScrollArea_InnerHeight, H)
EndProcedure
XML$ = "<window id='#PB_Any' name='test' text='test' width='400' height='400' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
" <vbox expand='item:1'>" +
" <scrollarea id='#PB_Any' name='Scroll1' scrolling='both' innerheight='500' innerwidth='500' />" +
" <button id='#PB_Any' name='Button1' text='Enlarge' onevent='OnButton1Event()'/>" +
" </vbox>" +
"</window>"
If ParseXML(#Xml, XML$) And XMLStatus(#Xml) = #PB_XML_Success
If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Else
Debug "Dialog error: " + DialogError(#Dialog)
EndIf
Else
Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
EndIfRe: ScrollAreaGadget and DialogXML
Hi spikey,
I remained focused and blinded by ResizeGadget as the only solution.
F1 is really a magic key !!!
Thanks a lot
Damn ! Why didn't I remember that?spikey wrote: You can change the internal dimensions using SetGadgetAttribute just as usual.
I remained focused and blinded by ResizeGadget as the only solution.
F1 is really a magic key !!!
Thanks a lot
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Except on this sentence...
