Difference between revisions of "Reference: MSEgui/TWidget"

From Free Pascal wiki
Jump to navigationJump to search
Line 17: Line 17:
  
 
===Properties===
 
===Properties===
 +
 +
====Anchors====
 +
 +
[[Image:msegui_anchors.png]]
 +
 +
<syntaxhighlight>
 +
 +
 +
</syntaxhighlight>
 +
 +
  
 
====Bounds====
 
====Bounds====

Revision as of 09:03, 14 December 2015

TWiget

work in progress

Ancestor for visual components.

Reference

Hierarchy

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

Properties

Anchors

msegui anchors.png


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

Visible

property Visible: boolean; default true;

Sets the widget visible or hides it.

Methods

Events