Login  Register

Re: Control of events in a macro?

Posted by ctrueden on May 06, 2015; 2:06am
URL: http://imagej.273.s1.nabble.com/Control-of-events-in-a-macro-tp5012702p5012728.html

Hi Pedro,

> I want to create a dialog with an option Checkbox that determines if a
> number input box is active (if Checkbox clicked) or inactive (if the
> Checkbox unclicked).

I do not know how to do this in a macro, but you can do it with ImageJ2's
parameterized command plugins. Here is an example which behaves as you
described:

   https://gist.github.com/ctrueden/7c4764e756c33110f58b

Regards,
Curtis

On Tue, May 5, 2015 at 3:55 PM, Pedro J Camello <[hidden email]> wrote:

> Dear Kees,
>
> thanks for your help.
>
> The problem with your code is that it passes the boolean after closing the
> dialogue; my intend was to change the number of an input box before closing
> the dialogue
>
> Dialog.create("Checkbox");
>         Dialog.addCheckbox("test", true);
>         Dialog.addNumber("interval", 15); // A number input with a 15 as
> default that should change to 0 if I un-click the checkbox
> Dialog.show();
> test = Dialog.getCheckbox();
> if (test==false)
>
>        //Here a code to change the number default to 0;
>
>
> Two sequential dialogue boxes would do the job, but I was looking for a
> more simple way....
>
> Pedro
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html