Re: StackWindowListener?

Posted by Kenneth Sloan-2 on
URL: http://imagej.273.s1.nabble.com/StackWindowListener-tp5023759p5023764.html

Thank you for the quick (and useful) response!

This sounds like just what I need.

On Fri, Jul 24, 2020 at 12:50 Michael Schmid <[hidden email]>
wrote:

> Hi Kenneth,
>
> when the user changes the stack slice and you register as ImageListener,
> you get an imageUpdated(imp) callback.
> If you are not interested in events other then changing the slice, you
> have to remember the slice number of the previous call.
>
> Note that ImagePlus.addImageListener is static, so you must register
> only once, and you get events for all windows.
> Don't forget to de-register with removeImageListener.
> Calling 'removeImageListener' too often does not hurt (it does nothing
> if your class is not registered), but in some cases forgetting it can
> cause trouble, because your plugin will still get called when all is
> finished.
>
>
> Michael
> ________________________________________________________________
> On 24.07.20 19:33, Kenneth Sloan wrote:
> > I find myself in need of what I would call a "StackWindowListener".
> >
> > I have an extension to StackWindow which is used in many of my plugins -
> which I prefer NOT to change (but I will, if I have to).
> >
> > Now, I have a need for a user-level program to get a callback when the
> slice is changed (via the usual stack control slider).  Is there a way to
> do that without modifying (or further extending) the existing StackWindow?
> >
> > ===============================================
> >
> > In the alternative - is there an easy way to create something like a
> GenericDialog which is displayed while allowing the CURRENT thread to
> continue.  Something that would allow:
> >
> > dialog.show();
> > while(!dialog.done()){...do something interesting}
> > // dialog done - get results
> >
> >
> > I can get the desired effect by using KeyListener and having the user
> interact with the keyboad, but I'd like the option of a graphical dialog
> box which remains displayed while the main program proceeds.
> >
> > --
> > Kenneth Sloan
> > [hidden email]
> > Vision is the art of seeing what is invisible to others.
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
--
-Kenneth Sloan

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html