Table of Contents

Class CadRibbonButton

Namespace
OpenCAD2D.Plugins
Assembly
OpenCAD2D.Core.dll

A button that starts a command, as a button of the presenter's own ribbon does, or runs a callback of the plugin at once on the window's thread.

public sealed class CadRibbonButton : CadRibbonItem
Inheritance
CadRibbonButton
Inherited Members

Constructors

CadRibbonButton(string, Action<CadPluginContext>)

Makes a button that runs a callback at once, on the window's thread.

CadRibbonButton(string, string)

Makes a button that starts a command: a command running is cancelled first, as AutoCAD's ^C^C is.

Properties

CanRun

Gets or sets whether the button is on, asked when the window asks its commands again (the selection, the drawing or a command changes). Null, until set: a button that starts a command or runs a macro is on while a drawing is open, one that runs a callback always. A predicate that throws gives false.

Command

Gets the command the button starts; null for a button that runs a callback or a macro.

Macro

Gets the macro the button runs; null for a button that starts a command or runs a callback.

Run

Gets the callback the button runs; null for a button that starts a command or runs a macro.

Methods

FromMacro(string, string)

Makes a button that runs a macro as AutoCAD's CUI buttons do: ^C cancels the command running, ;, a space and ^M are Enter, </code> waits for the user's answer, _ and . are as typed, and an expression in parentheses is AutoLISP. "^C^C_CIRCLE;0,0;" starts CIRCLE at 0,0 and waits for the radius. A macro that uses * to repeat, $M= or another ^ pair than C, M and P is refused where the button is pressed, with a line that says so. A plugin that uses it states [assembly: CadPluginApi("1.2")].