Code: Select all
#Dialog = 0
#Xml = 0
; XML$ = "<window id='#PB_Any' name='test' text='test' flags='#PB_Window_ScreenCentered | #PB_Window_Borderless' height='300' width='100' margin='vertical:0'>" +
XML$ = "<window id='#PB_Any' name='test' text='test' flags='#PB_Window_ScreenCentered | #PB_Window_Borderless' width='100' margin='vertical:0'>" +
" <vbox expand='item:1' spacing='1'>" +
" <editor name='listview_1'/>" +;" <listview name='listview_1'/>" +
" <canvas name='canvas_1' height='18'/>" +
" </vbox>" +
" </window>"
If ParseXML(#Xml, XML$) And XMLStatus(#Xml) = #PB_XML_Success
If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
For i=0 To 100
AddGadgetItem(DialogGadget(#Dialog, "listview_1"), -1,"#True"+Str(i))
RefreshDialog(#Dialog)
Next i
If StartDrawing(CanvasOutput(DialogGadget(#Dialog, "canvas_1")))
Box(0,0,OutputWidth(),OutputHeight(), #Red)
StopDrawing()
EndIf
; h=GadgetHeight(DialogGadget(#Dialog, "listview_1"),#PB_Gadget_RequiredSize)
; ResizeWindow(DialogWindow(#Dialog),#PB_Ignore,#PB_Ignore,h,#PB_Ignore)
Repeat
Event = WaitWindowEvent()
EventGadget = EventGadget()
Select Event
Case #PB_Event_Gadget
Select EventGadget
Case DialogGadget(#Dialog, "listview_1")
Select EventType()
Case#PB_EventType_Change
h=GadgetHeight(DialogGadget(#Dialog, "listview_1"),#PB_Gadget_RequiredSize)+GadgetHeight(DialogGadget(#Dialog, "canvas_1"))
ResizeWindow(DialogWindow(#Dialog),#PB_Ignore,#PB_Ignore,h,#PB_Ignore)
RefreshDialog(#Dialog)
EndSelect
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
Else
Debug "Erreur de la bibliothèque -Dialog- : " + DialogError(#Dialog)
EndIf
Else
Debug "Erreur XML : " + XMLError(#Xml) + " (Ligne: " + XMLErrorLine(#Xml) + ")"
EndIf