SB 3.10 - Strange display in dialog vbox
Posted: Thu Sep 11, 2025 4:35 pm
The red-filled canvas is not displayed correctly in the following example, even though the debug positions and sizes are correct. There should be no space between the gadgets (canvas). The bottom margin is also not maintained.
If all gadget heights are the same and greater than 10, everything is fine.
If all gadget heights are the same and greater than 10, everything is fine.
Code: Select all
XML$ = "<window id='0' name='Test' text='Test, what else?' margin='5' minwidth='300' flags='#PB_Window_SystemMenu|#PB_Window_ScreenCentered'>" +
" <vbox margin='0' spacing='5'>" +
" <canvas id='1' height='20' />" +
" <canvas id='2' height='20' />" +
" <canvas id='3' height='5' /> />" +
" </vbox>" +
"</window>"
If ParseXML(0, XML$) And XMLStatus(0) = #PB_XML_Success
If CreateDialog(0) And OpenXMLDialog(0, 0, "Test")
Debug "Dialog created"
Else
Debug "Dialog error: " + DialogError(0)
EndIf
Else
Debug "XML error: " + XMLError(0) + " (Line: " + XMLErrorLine(0) + ")"
EndIf
Debug ""
Debug "WindowHeight="+WindowHeight(0)
Width=GadgetWidth(1)
Height=GadgetHeight(1)
Debug ""
Debug "Gadget 1 (blue)"
Debug "Width="+Width
Debug "Height="+Height
Debug "Y="+GadgetY(1)
StartDrawing(CanvasOutput(1))
Box(0,0,Width,Height,$ff0000)
StopDrawing()
Width=GadgetWidth(2)
Height=GadgetHeight(2)
Debug ""
Debug "Gadget 2 (green)"
Debug "Width="+Width
Debug "Height="+Height
Debug "Y="+GadgetY(2)
StartDrawing(CanvasOutput(2))
Box(0,0,Width,Height,$00ff00)
StopDrawing()
Width=GadgetWidth(3)
Height=GadgetHeight(3)
Debug ""
Debug "Gadget 3 (red)"
Debug "Width="+Width
Debug "Height="+Height
Debug "Y="+GadgetY(3)
StartDrawing(CanvasOutput(3))
Box(0,0,Width,Height,$0000ff)
StopDrawing()