LayoutSetPadding

Syntax

Success = LayoutSetPadding(Layout, Padding)

Description

Sets the padding for all four sides (top, right, bottom, left) of the specified layout container simultaneously. Padding is the space between the layout's border and its content (child items).

Parameters

Layout
The handle of the layout object whose padding is to be set. If #Null, it targets the current layout.

Padding
The amount of padding (in integer units, likely DIPs) to apply to all four sides.

Return Value

Returns #True if the padding was successfully set, or #False if the layout handle was invalid.

Remarks

This is a shorthand for setting top, right, bottom, and left padding individually using their respective commands (LayoutSetPaddingTop() etc.). The layout is automatically updated after changing the padding.

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

MyWindow = CreateWindow(0, 0, 400, 300, "Layout Padding", #PG_Window_Default | #PG_Window_LayoutFlex) ; Create with a flex layout

If MyWindow
  ; Apply 20 units of padding to all sides of the current layout
  LayoutSetPadding(#Null, 20)

  Widget1 = CreateWidget(0, 0, 100, 50) ; Positioned inside padding
  WidgetSetClass(Widget1, "button") ; Make the widget use the Button widget's skin / styling

  WindowShow(MyWindow, #True, #PG_WindowShow_ScreenCentered)

  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf

StopProGUI()

See Also

LayoutGetPadding, LayoutSetPaddingTop, LayoutSetPaddingRight, LayoutSetPaddingBottom, LayoutSetPaddingLeft

Supported OS

Windows, Linux