SDK:Setting Tool Cursor

From Vectorworks Developer
Jump to: navigation, search

.SDK|SDK ..SDK:Types|SDK Types ..SDK:Using the SDK|Using the SDK ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference

Tool Cursor

Before the user clicks on the document with a tool, VectorWorks indicates the upcoming action by changing the cursor to reflect the mouse position on screen by sending kToolGetCursor event.

Note that this event is sent every time the cursor moves. So, you should be careful to make this event handler fast.


This event doesn't use any additional information from the message parameters (SDK:Tool Plug-in Main Function).


This routine should return a value that specifies the resource id of the appropriate cursor to be displayed.

Returning 0 will cause the cursor specified in the tool definition resource to be displayed. Any drawing that is done by the tool needs to be done during kToolDraw action handling and not during this action.

There are two types of cursors supported in VectorWorks 2008 and later:

  • Conventional cursors use a 1-bit mask and a 1-, 4- or 8-bit color image. By providing an empty mask, they can be designed to invert the color of the screen underneath it. They are limited to 16x16 pixels on the Macintosh and 32x32 pixels on Windows.
  • Alpha-blended cursors use a 32-bit RGBA image. They are 64x64 pixels in size on both platforms.

For conventional cursors, both a Macintosh and Windows resource must be provided.

On the Macintosh, it should be a 'CURS' resource which is either located in the VectorWorks application file or within the plug-in’s file. On Windows, it should either return the id of a Windows cursor resource that is located in the plug-in’s DLL file (not its QTR file), or return the id of a Macintosh 'CURS' resource that is located in the VectorWorks application file.

For alpha-blended cursors, a PNG file should be included as a 'PNG' Macintosh resource, and this same resource will be used on both platforms. Since there is no standard way to specify a hotspot in a PNG file, these cursor images must always be exactly 64x64 pixels in size, and the hotspot is always at location (32, 32). The "body" of the image should be placed within the 64x64 space appropriately.

For example, the "fill cursor" is placed in such a way that the tip of the dripping paint is at pixel (32, 32):


See Also

Personal tools

Advanced Search
See Also