How to create a toolbar button in Cache Studio that trigger a custom command after click ?
I would like to create a toolbar button in Cache Studio. After clicking on it, it would run a custom command (eg: to execute a routine that will clean a global).
I took a look at dialog that is shown after right clicking on a toolbar in Studio, then choosing "Customize" but AFAIK there is nothing there that allow such a thing.
I know it's possible to customize menu items by extending %Studio.SourceControl.Base class, is there something similar for toolbars ?
Here is some base code example (based on Danny Wijnschenk answer) :
(as he explained, the source control class has to be selected in the Portal (System Administration > Configuration > Additional settings > Source Control)
Class Test Extends %Studio.SourceControl.Base
{
XData Menu
{
<MenuBase>
<Menu Name="SourceControl" Type="0">
<MenuItem Name="NewItem"/>
</Menu>
</MenuBase>
}
Method UserAction(Type As %Integer, Name As %String, InternalName As %String, SelectedText As %String, ByRef Action As %String, ByRef Target As %String, ByRef Msg As %String, ByRef Reload As %Boolean) As %Status
{
if Name="SourceControl,NewItem"
{
//do something here
}
Quit $$$OK
}
}
Once menu item is added, it can be dragged to toolbar as a button.
Product version: Caché 2018.1