Hello,
Is it possible to trigger an "Option" macro by double-clicking an "Action Tool" macro button in the ImageJ toolbar? For instance, with the example toolset macro below I can access my macro options only by clicking on the "K" icon, not by double-clicking the "J" icon. Thanks! Christophe // test tool set // place it in /Applications/ImageJ/macros/toolsets/ requires(1.38m); var bUserName = true; var bJavaHome = false; var bJavaVersion = true; macro "Java Info Tool (try to double_click for options) Action Tool - T3d14J" { FinalString=""; if (bUserName) {FinalString = FinalString+"User name: "+getInfo("user.name")+"\n"; } if (bJavaHome) {FinalString = FinalString+"Java home: "+getInfo("java.home")+"\n"; } if (bJavaVersion) {FinalString = FinalString+"Java version: "+getInfo("java.version")+"\n"; } showMessage(FinalString); } macro "Java Info Tool (try to double_click for options) Action Tool Options" { Dialog.create("Java Info Action Tool Options"); Dialog.addCheckbox("Display user name", bUserName); Dialog.addCheckbox("Display java home", bJavaHome); Dialog.addCheckbox("Display java version", bJavaVersion); Dialog.show(); bUserName = Dialog.getCheckbox(); bJavaHome = Dialog.getCheckbox(); bJavaVersion = Dialog.getCheckbox(); } macro "Options for Java Info Tool Action Tool - T3d14K" { run("Java Info Tool (try to double_click for options) Action Tool Options"); } |
Christophe,
You could use the isKeyDown(key); to switch to an options dialog if the "alt" is down when you click on your action tool. example: var x=10; macro "macro1 Action Tool - C000T0d12MTad121"{ if (isKeyDown("alt")) { x=getNumber("x",x); exit(); } print (x); } Jerome. On 5/18/07, Garcion Christophe <[hidden email]> wrote: > > Hello, > > Is it possible to trigger an "Option" macro by double-clicking an > "Action Tool" macro button in the ImageJ toolbar? > For instance, with the example toolset macro below I can access my macro > options only by clicking on the "K" icon, not by double-clicking the > "J" icon. > > Thanks! > > Christophe > > > // test tool set > // place it in /Applications/ImageJ/macros/toolsets/ > > requires(1.38m); > var bUserName = true; > var bJavaHome = false; > var bJavaVersion = true; > > > macro "Java Info Tool (try to double_click for options) Action Tool - > T3d14J" { > FinalString=""; > if (bUserName) {FinalString = FinalString+"User name: > "+getInfo("user.name")+"\n"; } > if (bJavaHome) {FinalString = FinalString+"Java home: > "+getInfo("java.home")+"\n"; } > if (bJavaVersion) {FinalString = FinalString+"Java version: > "+getInfo("java.version")+"\n"; } > showMessage(FinalString); > } > > macro "Java Info Tool (try to double_click for options) Action Tool > Options" { > Dialog.create("Java Info Action Tool Options"); > Dialog.addCheckbox("Display user name", bUserName); > Dialog.addCheckbox("Display java home", bJavaHome); > Dialog.addCheckbox("Display java version", bJavaVersion); > Dialog.show(); > bUserName = Dialog.getCheckbox(); > bJavaHome = Dialog.getCheckbox(); > bJavaVersion = Dialog.getCheckbox(); > } > > macro "Options for Java Info Tool Action Tool - T3d14K" { > run("Java Info Tool (try to double_click for options) Action Tool > Options"); > } > |
Free forum by Nabble | Edit this page |