Canvas size inside a container
Posted: Sat Dec 06, 2025 10:33 am
On Windows, depending on the container's border, the canvas is cropped by 0, -2, -4, or -6 pixels.
Could you tell me what the values are on Linux and macOS?
Thank you.
(Use the code under to do that)
M.
Could you tell me what the values are on Linux and macOS?
Thank you.
(Use the code under to do that)
Code: Select all
Procedure draw()
StartDrawing(CanvasOutput(1))
Box(0, 0, 300, 200, #White)
LineXY(GetGadgetState(20), 0, GetGadgetState(20), 199, #Red)
LineXY(0, GetGadgetState(21), 300, GetGadgetState(21), #Green)
StopDrawing()
StartDrawing(CanvasOutput(3))
Box(0, 0, 300, 200, #White)
LineXY(GetGadgetState(20), 0, GetGadgetState(20), 199, #Red)
LineXY(0, GetGadgetState(21), 300, GetGadgetState(21), #Green)
StopDrawing()
StartDrawing(CanvasOutput(5))
Box(0, 0, 300, 200, #White)
LineXY(GetGadgetState(20), 0, GetGadgetState(20), 199, #Red)
LineXY(0, GetGadgetState(21), 300, GetGadgetState(21), #Green)
StopDrawing()
StartDrawing(CanvasOutput(7))
Box(0, 0, 300, 200, #White)
LineXY(GetGadgetState(20), 0, GetGadgetState(20), 199, #Red)
LineXY(0, GetGadgetState(21), 300, GetGadgetState(21), #Green)
StopDrawing()
StartDrawing(CanvasOutput(9))
Box(0, 0, 300, 200, #White)
LineXY(GetGadgetState(20), 0, GetGadgetState(20), 199, #Red)
LineXY(0, GetGadgetState(21), 300, GetGadgetState(21), #Green)
StopDrawing()
EndProcedure
If OpenWindow(0, 0, 0, 1000, 600, "ContainerGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ContainerGadget(0, 10, 10, 300, 200, #PB_Container_BorderLess)
w = 300
CanvasGadget(1, 0, 0, w, 200)
CloseGadgetList()
ContainerGadget(2, 20 + w, 10, 300, 200, #PB_Container_Flat)
CanvasGadget(3, 0, 0, w, 200)
CloseGadgetList()
ContainerGadget(4, 40 + w + w, 10, 300, 200, #PB_Container_Raised)
CanvasGadget(5, 0, 0, w, 200)
CloseGadgetList()
TextGadget(30, 10, 230, 900, 30, "Decrease the values of the spingadgets to reveal the limits of the canvasgadget within all containers. The canvasgadgets and containers all measure 300x200")
ContainerGadget(6, 0, 320, 300, 200, #PB_Container_Single)
CanvasGadget(7, 0, 0, w, 200)
CloseGadgetList()
ContainerGadget(8, 20 + w, 320, 300, 200, #PB_Container_Double)
CanvasGadget(9, 0, 0, w, 200)
CloseGadgetList()
SpinGadget(20, 70, 260, 80, 30, 0, 330, #PB_Spin_Numeric )
SetGadgetState(20, 299)
SpinGadget(21, 170, 260, 80, 30, 0, 330, #PB_Spin_Numeric )
SetGadgetState(21, 199)
draw()
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 20, 21
If EventType() = #PB_EventType_Change
draw()
EndIf
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf