Login  Register

Re: macro dialog interface

Posted by Wayne Rasband on May 07, 2008; 3:29pm
URL: http://imagej.273.s1.nabble.com/detect-motion-across-frames-tp3696278p3696283.html

> I have a small question of rather practical and esthetical nature:
> Is it possible to put options and checkboxes etc in a dialog next to
> instead
> of below each other with macro language?
> Many thanks in advance.
> Kind regards
> Winnok

In the v1.41c daily build you can use the

     Dialog.addCheckboxGroup(rows, columns, labels, defaults)

function to add a grid of checkboxes to a dialog box. Here is an
example:

   rows = 2;
   columns = 3;
   n = rows*columns;
   labels = newArray(n);
   defaults = newArray(n);
   for (i=0; i<n; i++) {
      labels[i] = "Checkbox "+i+1;
      if ((i%2)==0)
          defaults[i] = true;
      else
          defaults[i] = false;
   }
   Dialog.create("Checkbox Group");
   Dialog.addCheckboxGroup(rows,columns,labels,defaults);
   Dialog.show();
   for (i=0; i<n; i++)
       print(labels[i]+": "+Dialog.getCheckbox());

-wayne