Making a panel of buttons in a macro/plugin...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Making a panel of buttons in a macro/plugin...

macroexec
Hi all,

I have tried the ActionBar plugin, it is fantastic, but there doesn't seem to be a good way to communicate information between the buttons. ie, if I use one button to load input parameters, I want those parameters available to a macro called by a second button (there are too many parameters to look elegant passing as concatenated string).

What will be most helpful are any strategies that could help me do one of the following...

1) A way to add buttons to the create.Dialog panel through the macro language
2) A way to enable global variables in ActionBar so I can stick macros inside each button without passing arguments to remote macros
3) Any other way to make a button panel from inside a macro

Thank you for your help with so many questions on the forum (I found out about ActionBar from here)!
Reply | Threaded
Open this post in threaded view
|

Re: Making a panel of buttons in a macro/plugin...

jmutterer
Hi,
I'm sharing values by using the built-il preferences system. Once a value is
set, you can use it from another actionbar button, another macro, or from a
plugin, or javascript. It will also be saved when you quit and restart
ImageJ.

In a macro, use
call("ij.Prefs.set", "yourPrefix.x",x); to share the value of variable x,
and
call("ij.Prefs.get", "yourPrefix.x",defaultValue); to retrieve it.

From a plugin, see Ulf Dittmer's example at
http://rsb.info.nih.gov/ij/plugins/preference-demo.html
From javascript : Prefs.set("yourPrefix.x","test"); print
(Prefs.get("yourPrefix.x",""));

(there are too many parameters to look elegant passing as concatenated
> string).


The List.* functions will elegantly keep many parameters, and concatenate
them for you with string=List.getList(); You can then save this string using
the Preferences system.

Jerome.

On Tue, Apr 28, 2009 at 9:43 PM, macroexec <[hidden email]> wrote:

> Hi all,
>
> I have tried the ActionBar plugin, it is fantastic, but there doesn't seem
> to be a good way to communicate information between the buttons. ie, if I
> use one button to load input parameters, I want those parameters available
> to a macro called by a second button (there are too many parameters to look
> elegant passing as concatenated string).
>
> What will be most helpful are any strategies that could help me do one of
> the following...
>
> 1) A way to add buttons to the create.Dialog panel through the macro
> language
> 2) A way to enable global variables in ActionBar so I can stick macros
> inside each button without passing arguments to remote macros
> 3) Any other way to make a button panel from inside a macro
>
> Thank you for your help with so many questions on the forum (I found out
> about ActionBar from here)!
> --
> View this message in context:
> http://n2.nabble.com/Making-a-panel-of-buttons-in-a-macro-plugin...-tp2736381p2736381.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Making a panel of buttons in a macro/plugin...

macroexec

Wow! This is incredible!

Thanks, Jerome! also thanks for the ActionBar plugin!