Dialog Box location in Macro language

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

Dialog Box location in Macro language

Cyril Turiès
Hello, I would like to know if there is a way to set location of a dialog box in macro language?

I know this question has already been asked http://imagej.1557.x6.nabble.com/Dialog-box-placement-td4999820.html  but I don't understand the difference between 'WaitForUser' and 'Generic dialog' behaviour.
Why the first one remembers its position and why it is not possible to set location in the second one? (i.e. with a Dialog.setLocation(x,y)).

The macro I wrote opens each image in a specified directory one by one and prompt the user to check a ROI with yes/no radiobuttons.
If there is 300 images the user has to move the dialox box 300 times because it always displays over the image.

Thank you in advance for your help.

Cyril
Reply | Threaded
Open this post in threaded view
|

Re: Dialog Box location in Macro language

Rasband, Wayne (NIH/NIMH) [E]
On Jan 14, 2015, at 9:44 AM, Cyril Turiès <[hidden email]> wrote:

>
> Hello, I would like to know if there is a way to set location of a dialog box
> in macro language?
>
> I know this question has already been asked
> http://imagej.1557.x6.nabble.com/Dialog-box-placement-td4999820.html
> <http://imagej.1557.x6.nabble.com/Dialog-box-placement-td4999820.html>  
> but I don't understand the difference between 'WaitForUser' and 'Generic
> dialog' behaviour.
> Why the first one remembers its position and why it is not possible to set
> location in the second one? (i.e. with a Dialog.setLocation(x,y)).

The latest ImageJ daily build (1.49o23) adds a Dialog.setLocation(x,y) function to the macro language. Here is an example:

 x=10;
 y=200;
 Dialog.create("Dialog");
 Dialog.addMessage("This dialog is displayed at ("+x+","+y+").");
 Dialog.setLocation(x,y);
 Dialog.show()

And here is the JavaScript version:

 x=10;
 y=200;
 gd = new GenericDialog("Dialog");
 gd.addMessage("This dialog is displayed at ("+x+","+y+").");
 gd.setLocation(x,y);
 gd.showDialog()

-wayne


> The macro I wrote opens each image in a specified directory one by one and
> prompt the user to check a ROI with yes/no radiobuttons.
> If there is 300 images the user has to move the dialox box 300 times because
> it always displays over the image.
>
> Thank you in advance for your help.
>
> Cyril
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Dialog-Box-location-in-Macro-language-tp5011212.html
> Sent from the ImageJ mailing list archive at Nabble.com.


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Dialog Box location in Macro language

Cyril Turiès
Thank you very much Wayne for this addition in macro language.
Now the dialog box can be displayed on the right side of the active image:

getLocationAndSize(x, y, width, height);

Dialog.create("ROI check");
Dialog.addMessage("=> "+name);
items = newArray("Yes", "No");
Dialog.addRadioButtonGroup("Exclude image from analysis:", items, 1, 2, "No");
Dialog.addRadioButtonGroup("Redefine area manually:", items, 1, 2, "No");
Dialog.setLocation(x+width,y);
Dialog.show;


I am not ready to use the JavaScript version but it could be helpful for more advanced users.

Cyril