Download Now

    Reference TSpinBox

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

      TSpinBox = class(TWidget)
      protected
        function AutoSize: Boolean; override;
        function CanSelect: Boolean; override;
        procedure Paint(Stage: TPaintStage); 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;
        destructor Destroy; override;
        { The rectangle of an item in the list of a spinDropDown box }
        function ItemRect(Item: Integer): TRectF;
        { The item of that list at a point }
        function ItemFromPoint(const P: TPointF): Integer;
        { Show the list, scrolled so the chosen item can be seen }
        procedure DropDown;
        { Hide the list }
        procedure CloseUp;
        { Scroll the list so an item can be seen }
        procedure DropScrollTo(Index: Integer);
        { The height of an item in the list }
        function DropItemHeight: Float;
        { The whole list with its frame, empty if the list is not showing }
        function DropRect: TRectF;
        { The area holding the items, inside the frame and scroll bar }
        function DropArea: TRectF;
        { The rectangle of an item, moved by the scroll position }
        function DropItemRect(Index: Integer): TRectF;
        { The item at a point, or -1 if there is none }
        function DropItemFromPoint(X, Y: Float): Integer;
        { True if the list has a scroll bar }
        function DropBarVisible: Boolean;
        { The rectangle of the scroll bar of the list }
        function DropBarRect: TRectF;
        { The rectangle of the thumb of that scroll bar }
        function DropThumbRect: TRectF;
        { True while the list is showing }
        property Dropped: Boolean read FDropped;
        { The number of pixels the list is scrolled }
        property DropScroll: Float read FDropScroll;
        { Text shown before the chosen item }
        property Prefix: string read FPrefix write FPrefix;
        { The items to choose from }
        property Items: StringArray read FItems write SetItems;
        { The index of the chosen item }
        property ItemIndex: Integer read FItemIndex write SetItemIndex;
        { How another item is chosen, see TSpinBoxKind }
        property Kind: TSpinBoxKind read FKind write FKind;
        property OnChange;
        property OnClick;
        property OnKeyDown;
        property OnMouseDown;
        property OnMouseMove;
        property OnMouseUp;
      end;

    See also

    Float in Codebot.System.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