Parent Previous Next

Property ToolDefs[Index : TToolType] : TToolDef - Public

Read and runtime only

ToolDefs contains the tool descriptors for all tool classes registered with ImagePainter. To access one particular descriptor use the tool type as index:

 T : TToolDef;
  T := ToolDefs[atRectangle]

ToolDefs returns the TRectangle tool descriptor.

The descriptor is read when the tool is activated and used by ImagePainter to detect the user input event that should create the figure instance. It also describes some basic behavior of the resulting figure which is not likely to be altered during a working session.

It is, to some extent, possible to change the Capability property of the descriptor, but note that this will affect all coming figures based on the tool class. For instance:

Exclude(T.Capabilities, caSizable);
prevents all rectangles from being resized.

Note that you can only exclude capabilities. If you try to include one that the figure does not support, you get an exception. Also, exclusion cannot contain the caSingleSelect or caTemporary capability flags.

To change the capabilities of individual objects only, use the TFigure.FigCapabilities instead.

Many of the capabilities are included in the Flags property. Read this for simpler access to figure capabilities.   For instance:

Creating a tool descriptor is the responsibility of the tool writer.

See also
TToolDef class
RegisterToolDef procedure
Creating your own tools tutorial