All Cadcorp SIS API Methods

RibbonButton Method

Note: Strictly speaking RibbonButton (and MenuItem) are Objects rather than Methods.

The programmer can create a SisRibbonButton object and then add it to a SisRibbonGroup (section of the ribbon the application will appear under) that has already been defined. Similarly, there is no actual MenuItem Method but a SisMenuItem object.

Description

Adds a custom command to the ribbon Applications tab. See Building GisLink Applications - Adding custom commands.

Syntax

SisRibbonButton(strText, New SisClickHandler(AddressOf function))

Parameters

strText, Name of button object. This is the same as the object’s Text property but specified when the object is created.

function, function to call when the button is clicked.

Properties

AlwaysLargeImage
Is the image always to be shown large.

True    Image always shown large.
False    Image not always shown large.
Class
The class or group name this command is to be associated with. If set to "Item" or "" then the command will be available for all Item classes.
DefaultCommand
Is this to be the default command.
True    The command to be default.
False    The command not to be default.
Description
The command name.

Enabled
To enable the button, i.e. if the ribbon button is to be shown enabled or greyed out.
True    The button to be enabled.
False    The button to be greyed out.
Filter
Optionally specify a named Filter which all selected Items must pass for the command to be available.

Help
The prompt text to be displayed when the command is highlighted.

Icon
The name of the icon to use.

ID
Identifier property for the ribbon button (32-bit unsigned integer).

LargeImage
The name of the large image.

Locus
Optionally specifies a named Spatial Filter which all selected Items must pass for the command to be available.

MaxSelection
The maximum number of Items which may be selected to enable this command. If max is -1 then there is no limit.

MinSelection
The minimum number of Items which must be selected to make this command valid. If MinSelection is set to -1 then Hittable and Editable Items are valid. If MinSelection is set to 0 then no Items have to be selected. If MinSelection is set to 1 then only Editable Items are valid.

MinStatus
The minimum status of the Item, i.e. SIS_HITTABLE.

ParentControl
Read-only property. Gets the parent control of a child button.
 
e.g. Set the Parent Control ID to 999. You can then obtain that same ID via the child control using:
 
ChildButton.ParentControl.ID

RibbonGroup
The ribbon group name.

Selected
Sets a button to a “Selected/Highlighted” state. Boolean (True/False):



ShortcutKeys
Assign a shortcut key (or combination of keys) to a ribbon button.

e.g. Button.ShortcutKeys = Keys.Control Or Keys.X

ShortcutMenuKeys
Assign a shortcut key (or combination of keys) to a menu item. See ShortcutKeys above for example.

Note: For ShortcutKeys and ShortcutMenuKeys - When you set the DefaultCommand property of a SisRibbonButton which contains sub-items to false, then a command is executed when you click the icon, and the sub-menu is shown when you click below the icon. These are two different actions, so you need two different shortcuts.

SubItems
The ribbon group collection name.

Tag
Get or set the tag.
 
Text
Text shown under/next to the button.

Visible
Make a ribbon button visible or invisible.

Remarks

Available: D

Groups:

Example

Dim BigButton As SisRibbonButton = New SisRibbonButton("Translate", New SisClickHandler(AddressOf Translate))

BigButton.LargeImage = True
BigButton.Icon = My.Resources.ButtonImage
BigButton.Help = "Translates multiple files between supported formats"
BigButton.Description = "Batch Translator"