Download Now

    Reference TMemo

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

      TMemo = class(TWidget)
      protected
        function AutoSize: Boolean; override;
        function CanSelect: Boolean; override;
        procedure Resize; override;
        procedure DoKeyDown(var Args: TSceneKeyArgs); override;
        procedure DoKeyUp(var Args: TSceneKeyArgs); override;
        procedure DoTextInput(var Args: TSceneTextArgs); 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;
        { Select all of the text }
        procedure SelectAll;
        { Copy the selected text to the clipboard }
        procedure CopyToClipboard;
        { Copy the selected text to the clipboard and remove it }
        procedure CutToClipboard;
        { Replace the selected text with the text on the clipboard }
        procedure PasteFromClipboard;
        { The methods below are used by themes to draw the memo. Rectangles are
          relative to the top left of the memo. Themes call Prepare first. }
        procedure Prepare;
        { The area holding the text, inside the padding and scroll bars }
        function TextArea: 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 number of rows, which is more than the number of lines when lines wrap }
        function RowCount: Integer;
        { The text of a row }
        function RowText(Row: Integer): string;
        { Returns True if any of the row is selected, giving the left and right of
          the selection measured from the start of the row }
        function RowSelection(Row: Integer; out Left, Right: Float): Boolean;
        { The top of the caret measured from the top left of the unscrolled text }
        function CaretPoint: TPointF;
        { Returns True when the caret should be drawn in the current blink }
        function CaretVisible: Boolean;
        { The height of a row }
        property RowHeight: Float read FRowHeight;
        { The number of pixels the text is scrolled left and up }
        property ScrollX: Float read FScrollX;
        property ScrollY: Float read FScrollY;
        { The position of the caret }
        property Caret: Integer read FCaret;
        { The position where the selection begins }
        property SelStart: Integer read GetSelStart;
        { The number of bytes selected }
        property SelLength: Integer read GetSelLength;
        { The selected text }
        property SelText: string read GetSelText;
        { The text of the memo as a list of lines }
        property Lines: TStrings read GetLines write SetLines;
        { Continue long lines on the next row, True by default }
        property WordWrap: Boolean read FWordWrap write SetWordWrap;
        { Show scroll bars when the text does not fit and scroll with the mouse
          wheel, False by default }
        property ScrollBars: Boolean read FScrollBars write SetScrollBars;
        property OnChange;
        property OnClick;
        property OnKeyDown;
        property OnKeyUp;
        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
    TSceneTextArgs in Codebot.Render.Scenes.pas
    TSceneWheelArgs in Codebot.Render.Scenes.pas