Greetings,
Is there a good tutorial on recording??? Every time I get the urge to get
recording to work for my plugins I can find the parts, e.g. Recorder
class, but nothing that say this is how it is supposed to work as a whole,
especially the gotchas, n.b. needing to call get... methods????
Thanks in advance,
Fred
On Wed, April 29, 2026 10:27 am, Michael Schmid wrote:
> Hi Herbie,
>
> one more thing that comes into my mind:
>
> If you never call the "get..." method (such as getNextNumber,
> getNextString) of a GenericDialog, the component won't be macro-recorded.
>
> So you don't necessarily need gd.addPanel, you can add them Component as
> usual. But you have to retrieve its value without the gd.get... method
> of the GenericDialog. If you have dialogListener, also the
> DialogListner must not call gd.get... for this Component.
>
> Roughly like this:
>
> gd.addStringField("Text: ", suggestedText);
> Object textField = gd.getStringFields().lastElement();
> gd.showDialog();
> String theText = ((TextField)textField).getText();
> // Do NOT call gd.getNextString() !
>
> Nevertheless, you can still set the value of this field in a macro, e.g.
> run("My Plugin", "text=abcde");
> and it will behave as if the user had entered "abcde".
> Macro recording won't record "text=abcde", however.
>
>
> Michael
> ________________________________________________________________
> On 29.04.26 16:46, Gluender wrote:
>> Dear Michael,
>>
>> many thanks for your immediate reply and the suggestion!
>>
>> The approach may require some work ("get...", DialogListener) but it is
>> doable.
>>
>> Thanks for the link as well. As you know, more recently and for other
>> reasons I had a look at the ij.plugin.HyperStackConverter code.
>>
>> Thanks again
>>
>> Herbie
>>
>> ::::::::::::::::::::::::::::::::::::::::::::
>> Am 29.04.26 um 16:26 schrieb Michael Schmid:
>>> Hi Herbie,
>>>
>>> in a GenericDialog, you can add a panel with Components that are not
>>> handled by the GenericDialog itself.
>>>
>>> For these items, you can't retrieve the values (or status) with
>>> GenericDialog methods like gd.getNextNumber(); you have to do it with
>>> the "get..." method of the Component added.
>>> Also, a DialogListener of the GenericDialog (if any) won't be called,
>>> you have to register the appropriate listener (if required).
>>>
>>> An example are the 'auto' checkboxes of Image>Stack>Stack to
>>> HyperStack; the code is in ij.plugin.HyperStackConverter,
>>>
>>> https://github.com/imagej/ImageJ/blob/master/ij/plugin/HyperStackConverter.java
>>> (line 182â282)
>>>
>>>
>>> Michael
>>> ________________________________________________________________
>>> On 29.04.26 14:35, Gluender wrote:
>>>> Dear experts,
>>>>
>>>> is it possible (and if yes, how) to _exclude_ certain items of a
>>>> GenericDialog in a plugin-code from Macro-recording?
>>>>
>>>> Any ideas?
>>>>
>>>> Regards
>>>>
>>>> Herbie
>>>> :::::::::::::
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html