TTMSFNCBloxBlock Class
Base class for all block objects on a diagram. To create a custom block class, descend from this class, override the relevant drawing methods and publish the desired properties. The drawing methods most often overridden are
DrawShapeandDrawBlock.
API unit family: TMSFNCBloxCoreBlock
Inherits from: TTMSFNCBloxElement
Syntax
TTMSFNCBloxBlock = class(TTMSFNCBloxElement)
Remarks
A block carries its own position and size (BoundsRect), text content (Strings), background fill, shadow, an optional background picture and a set of resize and rotation handles.
Properties
| Name | Description |
|---|---|
| Alignment | Specifies the horizontal alignment of the block text. |
| Bottom | Specifies the bottom-most coordinate of the block, in block coordinates. Read-only. |
| BoundsRect | Specifies the position and size of the block: its left and top coordinates together with its width and height, in block coordinates. |
| ClipText | Controls whether the block text is clipped to the block shape. When True, text is restricted to the block clipping region; when False, text may extend beyond the shape. |
| CursorAngle | For internal use. |
| CursorRect | For internal use. |
| CursorRotCenter | For internal use. |
| Fill | Contains the background fill of the block, including color, gradient and fill type. |
| Height | Specifies the height of the block. |
| Left | Specifies the left coordinate of the block, in block coordinates. |
| MinHeight | Specifies the minimum height allowed for the block. The block cannot be resized to a height smaller than this value. |
| MinWidth | Specifies the minimum width allowed for the block. The block cannot be resized to a width smaller than this value. |
| Picture | Contains the background picture of the block. When the picture is empty, no picture is displayed. |
| PictureMode | Defines how the background picture is rendered inside the block shape. |
| Right | Specifies the right-most coordinate of the block, in block coordinates. Read-only. |
| RotationCenter | Specifies the rotation center of the block in relative (percentage) coordinates. A value of (50, 50) places the rotation center at the middle of the block. |
| RotationStep | Specifies the step, in degrees, applied while the user rotates the block interactively. Use larger steps (for example 30, 45 or 90) to snap rotation to specific angles. |
| Shadow | Contains the shadow of the block. Use the returned shadow object to set shadow visibility, offset and color. |
| Shape | Specifies the geometric shape used to draw the block. |
| Strings | Reads or writes the text displayed by the block, one line per string. |
| Top | Specifies the top coordinate of the block, in block coordinates. |
| VertAlign | Specifies the vertical alignment of the block text. |
| Width | Specifies the width of the block. |
| WordWrap | Specifies whether the block text wraps to multiple lines. When True, text that does not fit on a single line wraps within the block. |
Methods
| Name | Description |
|---|---|
| AnchorLinkChanged | Called whenever a link point of the block changes the anchor it is attached to. |
| AngledSurroundRect | Returns the four corner points of the block rotated by the given angle, in client coordinates. |
| BloxRotCenter | Returns the current position of the block's rotation center, expressed in client coordinates. |
| CreateDefaultLinkPoints | Clears the existing link points and creates the four default link points at the middle of the top, bottom, left and right edges of the block. |
| ElementRect | Returns the rectangle occupied by the block, equal to BoundsRect. |
| EndCursorPlacement | For internal use only. |
| GetHandlePos | Returns the position of the given handle in client coordinates, taking the handle style, current bounds and rotation of the block into account. |
| GetLinkPoint | Returns the position of the given link point in client coordinates, taking the current bounds and rotation of the block into account. |
| GetSurroundBlockPath | Fills the supplied path with the outline that surrounds the current block, in client coordinates, for use in path-based drawing modes. |
| GetTextCellRect | Returns the rectangle, in block coordinates, where a text cell is drawn. The base implementation returns the full block rectangle. Override in descendants to draw text in a different region, for example only the top half of the block. |
| HandleMoving | Updates the block while one of its handles is being dragged. Resize handles change the bounds, the rotate handle changes the angle and the rotation-center handle moves the rotation center. |
| HandlesChanged | Called whenever the handles collection of the block changes. |
| InitDrawer | For internal use only. |
| Inserted | Performs initialization that depends on the block being part of a diagram. Called when the block has been inserted into its parent diagram. |
| LinkedAnchorChanged | Called when an element this block is anchored to changes, allowing the block to react to the change of the anchored element. |
| MouseEnter | Called whenever the mouse pointer enters the block. |
| MouseLeave | Called whenever the mouse pointer leaves the block. |
| MovePosition | Moves the block by the given horizontal and vertical offsets. |
| PointInElement | Tests whether the given position lies inside the block shape, using the supplied path as a scratch buffer for the surrounding outline. |
| SetBounds | Sets the position and size of the block in a single call. |
| SetPosition | Moves the top-left corner of the block to the given position, keeping its size. |
| StartCursorPlacement | For internal use only. |
| StartMoving | Called when an interactive move of the block starts. |
| StartMovingHandle | Called when an interactive handle drag starts. |
| SurroundRect | Returns the axis-aligned rectangle that encloses the block taking its current rotation angle into account. |
| UpdateBlockHandles | Recreates the default handles for the block: the eight resize handles (top-left, top, top-right, right, bottom-right, bottom, bottom-left and left), the rotation handle and the rotation-center handle. |
| UpdateDrawing | Called while the block is being drawn interactively. |
| UpdateInserting | Updates the block bounds while it is being inserted interactively, using the start and end points carried by the supplied information. |
| UpdateMoving | Updates the block position while it is being moved interactively. Positions the move cursor or commits the new bounds depending on the action carried by the supplied information. |