Re: More GenericDialog fun
Posted by
Michael Doube on
May 11, 2010; 2:15pm
URL: http://imagej.273.s1.nabble.com/More-GenericDialog-fun-tp3688333p3688335.html
Michael
I tried catching exceptions and none were thrown. My implementation is
pretty simple, as in this example, which adds a listener to a dialog
containing a choice menu. If "voxel" is selected, the numeric field is
greyed out (setEnabled(false)) by the dialogItemChanged method.
http://github.com/mdoube/BoneJ/blob/master/src/org/doube/bonej/VolumeFraction.javaIf I include the DialogListener, options are not recorded. Commenting
out gd.addDialogListener restores option recordability (tested on IJ
1.43u and 1.44a8).
Could this be a difference between ItemListeners (which I haven't yet
used) and DialogListeners (which I currently use)?
Michael
> this cannot be a general problem with DialogListeners; most filters
> and some other functions in ImageJ use a DialogListener and get
> recorded.
> Maybe your DialogListener causes an exception? You could check it
> like this:
> try {
> ... DialogListener code ...
> }
> catch (Exception e) { IJ.log("Exception in DialogListener "+e); }
>
> Michael
> ________________________________________________________________
>
> On 11 May 2010, at 13:12, Michael Doube wrote:
>
>> Hi all
>>
>> Thanks for your very useful comments regarding layout.
>>
>> While messing around with layout, I noticed that GenericDialogs
>> with a dialog listener, added with:
>>
>> gd.addDialogListener(this);
>>
>> just before:
>>
>> gd.showDialog();
>>
>> Do not have their options recorded by the Macro Recorder.
>>
>> Commenting out gd.addDialogListener(this); restores macro
>> recordability.
>>
>> Is this a known issue, and if so, how can I have dialog listeners
>> while maintaining macro recordability?