Login  Register

how to specify the screen position of a GenericDialog from a macro?

Posted by Bill Christens-Barry on Sep 09, 2015; 7:45pm
URL: http://imagej.273.s1.nabble.com/how-to-specify-the-screen-position-of-a-GenericDialog-from-a-macro-tp5014297.html

I'd like to be able to specify the screen position of a GenericDialog from a macro. 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