SetTool()
Summary
Sets the active tool item.
Changes
Added cursor parameter and options array in Version 2022.
Syntax
SetTool(string item_name [, string cursor] [, array options] )
| Argument | Contents |
|---|---|
| item_name | The name of the tool item |
| cursor | Sets the cursor for the tool |
| Option | Type | Contents |
|---|---|---|
| OnRun | String | A macro or a macro block to be run every time the tool is activated |
| OnDone | Integer | A macro or a macro block to be run every time another tool is activated |
Notes
The specified item must be in the current dialog box.
This function may be called in the Init macro of a dialog box to set the tool item active when the dialog is initially displayed.
Example
if method = 1 then SetTool("my edit tool")
else SetItem("my add tool")
// using onRUn and OnDone options with macro blocks
opts.OnRun = (do
c = ClickCoord()
ShowMessage("Action Block, Clicked Coordinate (" + i2s(c.lon) + "," + i2s(c.lat) +")")
end)
opts.OnDone = (do
ShowMessage("Action Block Leaving")
end)
SetTool( "my tool","Arrow" , opts )
Error Codes
| Error Type | Meaning |
|---|---|
| NotFound | The specified item does not exist or is not in the current dialog box |
See Also
| Function | Summary |
|---|---|
| GetTool() | Gets the name of the active tool item |
| SetCursor() | Sets the system pointer cursor style to one of several predefined options. |