Download Now

    Reference TWindow

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

    TWindow is a container with a title bar. It can be dragged, closed, resized, and shown as a modal window.
      TWindow = class(TContainerWidget)
      protected
        function GetBorders: TRectF; override;
        procedure DoModalResult; override;
        procedure DoClick; override;
        procedure DoMouseDown(var Args: TSceneMouseArgs); override;
        procedure DoMouseMove(var Args: TSceneMouseArgs); override;
        procedure DoMouseUp(var Args: TSceneMouseArgs); override;
      public
        constructor Create(Parent: TWidget; const Name: string = ''); override;
        function Pack: Boolean; override;
        { Show the window and make it the active window }
        procedure Show;
        { Hide the window, which ends a modal window with a cancel result }
        procedure Hide;
        { Close fires OnClose then hides the window, which ends a modal window with
          a cancel result. It is called when the close button is clicked. }
        procedure Close; virtual;
        { The close button rectangle relative to the window, empty if there is none }
        function CloseRect: TRectF;
        { True while the mouse is over the close button }
        function CloseHot: Boolean;
        { True while the close button is held down with the mouse over it }
        function ClosePressed: Boolean;
        { Show a close button in the title bar, True by default. The theme decides
          where it is and how it looks. }
        property CloseButton: Boolean read FCloseButton write FCloseButton;
        { OnClose fires when the window is closed. Do not free the window in it. }
        property OnClose: TNotifyEvent read FOnClose write FOnClose;
        { The size grip rectangle relative to the window, empty if there is none }
        function SizeRect: TRectF;
        { A window is as large as the widgets packed inside it, so it is resized by
          resizing one of them. When Sizeable is true a grip is shown at the bottom
          right of the window, and dragging the grip changes the width and height of
          SizeWidget, which the window is then packed around. }
        property Sizeable: Boolean read FSizeable write FSizeable;
        { The widget inside the window which is resized by the size grip }
        property SizeWidget: TWidget read FSizeWidget write FSizeWidget;
        { OnResize fires as SizeWidget is resized by the size grip }
        property OnResize: TNotifyEvent read FOnResize write FOnResize;
        { Causes a window to be shown above other windows returning the status on
          close }
        procedure ShowModal(OnModalResult: TModalResultEvent);
        property OnClick;
        property OnKeyDown;
        property OnMouseDown;
        property OnMouseMove;
        property OnMouseUp;
      end;

    See also

    TRectF in Codebot.Graphics.Types.pas
    TSceneMouseArgs in Codebot.Render.Scenes.pas