Download Now
Forums

    Reference TScrollBox

    Declared in Codebot.Render.Widgets.pas on line 1365

      TScrollBox = class(TWidget)
      protected
        function AutoSize: Boolean; override;
        function CanSelect: Boolean; override;
        procedure Paint(Stage: TPaintStage); override;
        function SelectsForChildren: Boolean; override;
        procedure ChildSelected(Child: TWidget); override;
        function ClientOffset: TPointF; override;
        function ClientClip(out Rect: TRectF): Boolean; override;
        procedure DoKeyDown(var Args: TSceneKeyArgs); override;
        procedure DoMouseDown(var Args: TSceneMouseArgs); override;
        procedure DoMouseMove(var Args: TSceneMouseArgs); override;
        procedure DoMouseUp(var Args: TSceneMouseArgs); override;
        procedure DoMouseWheel(var Args: TSceneWheelArgs); override;
      public
        constructor Create(Parent: TWidget; const Name: string = ''); override;
        function Pack: Boolean; override;
        { Scroll so that a widget inside the scroll box can be seen }
        procedure ScrollToWidget(Widget: TWidget);
        { The width content can have and fit beside the vertical scroll bar }
        function FitWidth: Float;
        { The area the children are seen in, inside the frame and scroll bars }
        function ClientArea: TRectF;
        { True if a scroll bar is showing }
        function BarVisible(Bar: TMemoBar): Boolean;
        { The rectangle of a scroll bar }
        function BarRect(Bar: TMemoBar): TRectF;
        { The rectangle of the thumb of a scroll bar }
        function ThumbRect(Bar: TMemoBar): TRectF;
        { The size of the children, measured when the scroll box is packed }
        property ContentWidth: Float read FContentWidth;
        property ContentHeight: Float read FContentHeight;
        { The number of pixels the children are scrolled. Setting them keeps the
          children inside the scroll box. }
        property ScrollX: Float read FScrollX write SetScrollX;
        property ScrollY: Float read FScrollY write SetScrollY;
        { Draw a frame and background, True by default }
        property Framed: Boolean read FFramed write SetFramed;
        { An image drawn behind the children which does not scroll }
        property Image: IBitmap read FImage write FImage;
        { How the image fills the client area, tileNone by default }
        property ImageMode: TTileMode read FImageMode write FImageMode;
        { From 0, black, through 0.5, the image as it is, to 1, white. The default
          is 0.5. }
        property ImageBrightness: Float read FImageBrightness write FImageBrightness;
        { OnPaintBackground fires each frame before the children are drawn, with the
          client area on the canvas, to draw a background which does not scroll.
          Drawing is clipped to the client area. }
        property OnPaintBackground: TPaintEvent read FOnPaintBackground write FOnPaintBackground;
        property OnKeyDown;
        property OnMouseDown;
        property OnMouseMove;
        property OnMouseUp;
      end;

    See also

    Float in Codebot.System.pas
    IBitmap in Codebot.Render.Graphics.pas
    TPointF in Codebot.Graphics.Types.pas
    TRectF in Codebot.Graphics.Types.pas
    TSceneKeyArgs in Codebot.Render.Scenes.pas
    TSceneMouseArgs in Codebot.Render.Scenes.pas
    TSceneWheelArgs in Codebot.Render.Scenes.pas