Plugin with own context menu!?

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

Plugin with own context menu!?

Joachim Wesner
Hi group,

I would like to write a plugin that overrides or extends the mouse context
menu of it´s image(s) with own operations to add some simple "dynamic
functionality" to the plugin.
(A regular Plugin or PluginFilter is more static, usually after it´s run
you need to rerun it on the original source image if you want to get to the
dialog to change any parameters etc.)

I have a basic idea how to achieve this via mouse listeners etc. but I
wonder if there is a simpler solution that uses ImageJ built-in
functionality.

Has anybody already done something like that in his plugin?

Sincerely

Joachim Wesner


Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht
Wetzlar  HRB 2432
Geschäftsführer:  Dr. Stefan Traeger | Dr. Wolf-Otto Reuter | Dr. David Roy
Martyr | Colin Davis
www.leica-microsystems.com


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Plugin with own context menu!?

Wayne Rasband
 >Hi group,
 >
 >I would like to write a plugin that overrides or extends
 >the mouse context menu of it´s image(s) with own
 >operations to add some simple "dynamic functionality"
 >to the plugin.
 >(A regular Plugin or PluginFilter is more static, usually
 >after it´s run you need to rerun it on the original source
 >image if you want to get to the dialog to change any
 >parameters etc.)
 >
 >I have a basic idea how to achieve this via mouse
 >listeners etc. but I wonder if there is a simpler solution
 >that uses ImageJ built-in functionality.
 >
 >Has anybody already done something like that in his plugin?

You can write a simple macro to customize the contextual menu that
appears when you right click on an image. There is an example at

     http://rsb.info.nih.gov/ij/macros/CustomPopupMenu.txt

Look at the the installPopupMenu() method in ImageJ's MacroInstaller
class at

     http://rsb.info.nih.gov/ij/source/ij/plugin/MacroInstaller.java

to see how to do this in a plugin.

It would be better and easier, however, to simply add a "Preview"
button to your plugin's dialog box. There is a plugin at

     http://rsb.info.nih.gov/ij/plugins/erode-demo.html

that demonstrates how to do this. It also demonstrates how to add a
"Help" button to a dialog box.

-wayne