Adding a DialogListener stops Macro Recording

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

Adding a DialogListener stops Macro Recording

Stephan Preibisch
Hi,

after dissecting why the macro recording does not work for my plugin I came up with a minimal example (see below). Adding the simple DialogListener to the GenericDialog completely inhibits macro recording, without that it is recorded:

import ij.IJ;
import ij.gui.DialogListener;
import ij.gui.GenericDialog;
import ij.plugin.PlugIn;

import java.awt.AWTEvent;

public class Test_Recording implements PlugIn
{
        public void run(String arg0)
        {
                final GenericDialog gd = new GenericDialog( "Test" );
                gd.addNumericField( "test input", 5, 4 );
                // this disables the macro recorder
                gd.addDialogListener( new DialogListener() {
                        public boolean dialogItemChanged(GenericDialog arg0, AWTEvent arg1)
                        {
                                IJ.log( "value changed" );
                                return true;
                        }
                });
                gd.showDialog();
                if ( gd.wasCanceled() ) return;
                IJ.log( "typed: " + gd.getNextNumber() );
        }
}

Does anyone encounter this problem before and maybe has already a solution? I am using ij-1.48v.jar.

Thanks a lot,
Stephan
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html