Difference between revisions of "Reference: MSEgui/TWidget"

From Free Pascal wiki
Jump to navigationJump to search
Line 108: Line 108:
 
====Font====
 
====Font====
  
See [[Reference:_MSEgui/TFont|Font]]
+
See [[Reference:_MSEgui/TFont|TFont]]
  
 
====Visible====
 
====Visible====

Revision as of 09:32, 16 December 2015

TWiget

work in progress

Ancestor for visual components.

Reference

Hierarchy

  • TObject
  • TPersistent
  • TComponent
  • TMseComponent
  • TActComponent
  • TWidget

Properties

Anchors

Anchors combines the traditional Anchors and the traditions Align properties.

msegui anchors.png

property anchors: anchorsty read fanchors write setanchors default defaultanchors;

By default your anchors are an_left and an_top. Then your widget stays at the same position when sizing the form. When your widget should have a constant distance to the right border of its parent, you add an_right and remove an_left (in this order...). The same you can do with an_bottom and an_top.

If you have only one anchor, and the widget is suitable for this sizing, the widget is using the full size of the not anchored dimension. The behaviour is near the traditional property Align, but the widget is not aligned directly to the border, but you can free position it.

msegui an top.png

By having no anchors set, the widget fills the client size of its parent (the traditional alClient).

By setting an_left and an_top, the widget change its horizontal size by sizing its parent, the same with the vertical size by setting an_top and an_bottom together.

Bounds

The size and the position of the widget is condensed in the property bounds, but you have also the traditional properties like left an width.

msegui bounds.png

// the types
sizety = record
  cx, cy: integer;
end;

pointty = record
  x,y: integer;
end;

rectty = record
case integer of
  0: (x, y, cx, cy: integer);
  1: (pos: pointty; size: sizety);
end;


// the properties
property Widgetrect: rectty read FWidgetrect write SetWidgetrect;
property Pos: pointty read FWidgetrect.pos write SetPos;
property Size: sizety read FWidgetrect.size write SetSize;

property Bounds_x: integer read FWidgetrect.x write SetBounds_x;
property Bounds_y: integer read FWidgetrect.y write SetBounds_y;
property Bounds_cx: integer read FWidgetrect.cx write SetBounds_cx
               {default defaultwidgetwidth} stored true;
property Bounds_cy: integer read FWidgetrect.cy write SetBounds_cy
               {default defaultwidgetheight} stored true;
property Bounds_cxmin: integer read FMinSize.cx
                                   write SetBounds_cxmin default 0;
property Bounds_cymin: integer read FMinSize.cy
                                   write SetBounds_cymin default 0;
property Bounds_cxmax: integer read FMaxSize.cx
                                   write SetBounds_cxmax default 0;
property Bounds_cymax: integer read FMaxSize.cy
                                   write SetBounds_cymax default 0;

property Left: integer read FWidgetrect.x write SetBounds_x;
property Right: integer read GetRight write SetRight;
             //widgetrect.x + widgetrect.cx, sets cx if an_left is set
property Top: integer read FWidgetrect.y write SetBounds_y;
property Bottom: integer read GetBottom write SetBottom;
             //widgetrect.y + widgetrect.cy, sets cy if an_top is set
property Width: integer read FWidgetrect.cx write SetBounds_cx;
property Height: integer read FWidgetrect.cy write SetBounds_cy;

property MinSize: sizety read FMinSize write SetMinSize;
function WidgetMinSize: sizety;
        //calls checkwidgetsize and frame.checkwidgetsize
property MaxSize: sizety read FMaxSize write SetMaxSize;

Enabled

property Enabled: boolean; default true;

Sets the widget enabled or not. Some Widgets change their look if they are not enabled, others do not.

msegui enabled.png

Font

See TFont

Visible

property Visible: boolean; default true;

Sets the widget visible or hides it.

Methods

Events

known issues

issues of the class

issues of this documentation

Feel free to add your points here.