On Sep 9, 2015, at 3:45 PM, Bill Christens-Barry <
[hidden email]> wrote:
>
> I'd like to be able to specify the screen position of a GenericDialog from a macro.
Use the Dialog.setLocation(x,y) macro function. 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();
I added this function in ImageJ 1.49o but forgot to document it.
-wayne
> To do this I've tried the GenericDialog.setLocation() and Macro.getOptions() methods in a plugin run by the macro. This has been only partly successful, and I am confused by a problem I've had.
>
> If I execute macro code containing the command:
>
> run("MyPlugin", "100, 400");
>
> the passed String argument ("100, 400") can be parsed and used by MyPlugin, but no GenericDialog is displayed. If I remove the argument in this macro command and remove Macro.getOptions() from MyPlugin and try:
>
> run("MyPlugin");
>
> the GenericDialog is displayed if the location arguments needed by the GenericDialog.setLocation() method are hard-coded in the MyPlugin.
>
> Is there inherent interaction between arguments passed by a macro via "run" and GenericDialogs? Are arguments passed using "run" used in some particular way to prepopulate fields of a GenericDialog?
>
> I'm using ImageJ 1.50b, Java 6, and MacOS 10.9.5. I can post code if that would be helpful.
>
> Thanks.
>
> Bill Christens-Barry
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html