0% found this document useful (0 votes)
190 views10 pages

Action Bar Cheat Sheet

- The document describes how to create custom toolbars and mini applications using the Action Bar plugin in ImageJ. - Key elements that can be specified include buttons, labels, backgrounds, icons, macros to run on button press, and global modifiers like always on top or sticking to the ImageJ window. - The Action Bar command lets you design bars visually or programmatically generate the configuration string to create bars dynamically.

Uploaded by

Juan Jose Lozano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
190 views10 pages

Action Bar Cheat Sheet

- The document describes how to create custom toolbars and mini applications using the Action Bar plugin in ImageJ. - Key elements that can be specified include buttons, labels, backgrounds, icons, macros to run on button press, and global modifiers like always on top or sticking to the ImageJ window. - The Action Bar command lets you design bars visually or programmatically generate the configuration string to create bars dynamically.

Uploaded by

Juan Jose Lozano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Custom toolbars and mini applications with Action Bar

- cheat sheet -

Latest Action Bar version can be obtained at https://doi.org/10.6084/m9.figshare.3397603


Or for Fiji users by activating the IBMP-CNRS update site
CC BY 4.0, J. Mutterer, 2021
Simple Action Bar
run("Action Bar","/plugins/ActionBar/bar_name.ijm");
exit();

<text>Hello ActionBar

<line>

<button> ● The macro calls the Action Bar plugin with


label=Press me itself as an argument
bgcolor=#FFFF88
● The Action Bar plugin renders the panel
arg=<macro>
print("Hello"); ● <text> also accepts html syntax
</macro> ● Duplicate <line>..</line> for multiple lines
</line> ● Duplicate <button> section for multiple buttons
● A button runs the code inside <macro>..</macro>

CC BY 4.0, J. Mutterer, 2021


Button properties

<button>
label=<html><h1><font color='red'>Press me</font></h1></html>
bgcolor=#FFFF88
arg=<macro>
print("Hello"); ● label=... the button’s text label (also takes
</macro> html)
<button> ● bgcolor=#ffff88the button’s background color
icon=bar_name/microscope.png ● icon=... the button’s face icon
arg=<macro>
print("Hello"); ● arg=... the button’s action
</macro> ○ arg=s=”hello”;print(s); single line
○ arg=<macro>... </macro> multi-line
○ arg=<tool>... </tool> multi-line tool
○ arg=<hide> toggle ImageJ main window
○ arg=<close> close this bar
CC BY 4.0, J. Mutterer, 2021
Button modifiers

<separator> Adds a space between two buttons in the same line

<button><enabled>... Button is enabled if macro code returns 1


label=test
(Only works for sticky bars)

<text>Workflow Before or after a button, adds a text label (see example)

CC BY 4.0, J. Mutterer, 2021


Global modifiers
<onTop> Will always be on top of other windows
<popup> Appears undecorated at mouse click location. Closes when button pressed
<noGrid> Disables consistent layout. Buttons are the width of their content
<sticky> Sticks to the active window, if any
<stickToImageJ> Inserts an action bar inside the ImageJ main window (see examples slide#9)
<main> Hides ImageJ, and closing this bar will quit ImageJ
<icon> Sets the bar icon to the specified path
<hideMenus> With OsX, hides ImageJ menus when bar is selected

CC BY 4.0, J. Mutterer, 2021


Global modifiers

<disableAltClose> Without this, alt clicking a button closes the bar


<disableCtrlAltEdit> Without this, ctrl-alt clicking a button opens the bar config file
<recordable> Records buttons actions in the Recorder (double check the code)
<beanshell> Use beanshell instead of macros
<DnD> Bar accepts drag and drop, just like ImageJ toolbar
<fromString> Build a string starting like this and pass it as an argument
to create an actionbar programmatically instead of from a file

CC BY 4.0, J. Mutterer, 2021


Global modifiers

<startupAction> Specify macro code to be run when this bar is started


run(“Fresh Start”);

</startupAction>

<codeLibrary> Specify macro code that will be shared across buttons. The same
function test() {
… code is appended to each button code. Typically functions.
}
</codeLibrary>

<DnDAction> Bar accepts drag and drop and specify macro code to be run upon
f=getArgument();
open(f); dropping a file on this bar

</DnDAction>

CC BY 4.0, J. Mutterer, 2021


Helper Action Bars
The Design Action Bar helps Starting the “Action Bar” command
you with writing Action Bars lets you create an empty bar with
(many) buttons

CC BY 4.0, J. Mutterer, 2021


Embedded Action Bars

using
<stickToImageJ>

CC BY 4.0, J. Mutterer, 2021


Action Bars <fromString> (version>2.15)
Configuration is read from as a string, not from a file,
so buttons/actions can be programmatically adjusted,
or actionbars can be created on-the-fly.

CC BY 4.0, J. Mutterer, 2021

You might also like