Login  Register

Re: macro dialog interface

Posted by Winnok H. De Vos on May 08, 2008; 7:28am
URL: http://imagej.273.s1.nabble.com/detect-motion-across-frames-tp3696278p3696284.html

Thanks Wayne that's great!
Do you think it will be expanded to other Dialog attributes such as options
and numbers or a more general Dialog.addGroup function?
Kind regards,
Winnok

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Wayne
Rasband
Sent: woensdag 7 mei 2008 17:29
To: [hidden email]
Subject: Re: macro dialog interface

> 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

No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.23.9/1417 - Release Date: 6/05/2008
8:07
 

No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.23.9/1417 - Release Date: 6/05/2008
8:07