[Overview][Resource strings][Constants][Types][Classes][Procedures and functions] Reference for unit 'fpGUI' (#fpgui)

TWidget

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

The TWidget class is the base class of all user interface objects.

Declaration

Source position: widget.inc line 167

type TWidget = class(TComponent)

protected

  FCursor: TFCursor;

  

  FText: String;

  

  FStyle: TStyle;

  

  FCanExpandHeight: Boolean;

  

  FCanExpandWidth: Boolean;

  

  FEnabled: Boolean;

  

  FVisible: Boolean;

  

  FOrigin: TPoint;

  

  FBoundsSize: TSize;

  

  FClientRect: TRect;

  

  FMinSize: TSize;

  

  FMaxSize: TSize;

  

  FDefSize: TSize;

  

  WidgetStyle: TWidgetStyle;

  

  WidgetState: TWidgetState;

  

  procedure Loaded; override;

  

  procedure Click; dynamic;

  

  procedure Paint(); virtual;

  

  procedure SetParentComponent(); override;

  

  procedure CalcSizes; virtual; abstract;

  

  procedure Resized; virtual;

  

  function ProcessEvent(); virtual;

  

Processes all incoming event objects

  function DistributeEvent(); virtual;

  

Distributes event objects to it's children

  procedure EvFocusChanged; dynamic;

  

  procedure EvKeyPressed(); dynamic;

  

  procedure EvKeyReleased(); dynamic;

  

  procedure EvKeyChar(); dynamic;

  

  procedure EvTextChanged; dynamic;

  

  function DoMouseEnter();

  

  function GetStyle;

  

  procedure SetCanExpandWidth();

  

  procedure SetCanExpandHeight();

  

  procedure SetText(); virtual;

  

  property CanExpandWidth: Boolean; [rw]

  

  property CanExpandHeight: Boolean; [rw]

  

  property Cursor: TFCursor; [rw]

  

Specifies the image used to represent the mouse pointer when it passes into the region covered by the widget.

  property Text: String; [rw]

  

  property Color: TColor; [rw]

  property OnClick: TNotifyEvent; [rw]

  

public

  constructor Create(); override;

  

  destructor Destroy; override;

  

  function SendEvent();

  

  function FindForm;

  

  procedure SetEmbeddedParent();

  

  procedure SetBounds();

  

  function WidgetToClient(); virtual;

  

  function ClientToWidget(); virtual;

  

  function ClientToScreen(); virtual;

  

  procedure Show; dynamic;

  

  procedure Hide; dynamic;

  

  procedure Redraw();

  

  procedure Scroll();

  

  procedure SetFocus;

  

  procedure Update;

  

  property Parent: TWidget; [rw]

  

  property Origin: TPoint; [r]

  

  property BoundsSize: TSize; [r]

  

  property BoundsRect: TRect; [r]

  

  property Left: Integer; [r]

  

  property Top: Integer; [r]

  

  property Width: Integer; [r]

  

  property Height: Integer; [r]

  

  property MinSize: TSize; [r]

  

  property MaxSize: TSize; [r]

  

  property DefSize: TSize; [r]

  

  property ClientRect: TRect; [r]

  

  property Style: TStyle; [rw]

  

Sets or Gets the widget's GUI style

  property Enabled: Boolean; [rw]

  

Controls whether the widget responds to mouse, keyboard and timer events.

  property Visible: Boolean; [rw]

  

end;

Inheritance

TWidget

  

The TWidget class is the base class of all user interface objects.

|

TComponent

?

TObject

Description

Widgets are components that are normally visual and the user can see them and possibly interact with them at runtime. All widgets have properties, methods and events that describe aspects of their appearance, such as the position of the widget, the cursor or hint associated with the widget, methods to paint or move the widget and events that respond to user actions.

TWidget has many protected properties and methods that are used or published by its descendants.

If you want to use a TWidget to hold child widgets you will probably want to add a layout to the parent TWidget.

See also

TLayout

  

The fpGUI layout system provides a simple and powerful way of specifying the layout of child widgets