Posted by
Michael Schmid on
Sep 24, 2019; 5:26pm
URL: http://imagej.273.s1.nabble.com/No-button-within-GenericDialog-class-feature-update-tp5022458p5022462.html
Hi Herbie,
without additional effort the actions done by the button(s) would not be
macro-recordable.
I also don't see a clear concept for macro recording of buttons in the
general case: If the user sets some value, presses a button, sets
another value in the same field, presses a button, and the result
depends on what has been done in what sequence, one would have to record
more than one value for a given field, This is incompatible with the
ImageJ concept of macro recording.
However, the applications I have in mind are more in the spirit of
'preview', doing some actions that allow the user to refine the
parameters, showing additional information.
Or in a NonBlockingGenericDialog let the user do some selection (highly
interactive things that are not macro-recordable anyhow, unless, say the
selection coordinates go numeric fields of the dialog and will be
recorded that way).
Philippe, which type of applications did you have in mind?
Is it something where macro recording would make sense?
---
I can't say anything concerning macro recording of the ImageJ2-style
interface; I did not venture beyond ImageJ 1 so far.
Best,
Michael
________________________________________________________________
On 24.09.19 19:05, Herbie wrote:
> Good day!
>
> Are the proposed approaches (especially "ImageJ2-style Command")
compatible with the GenericDialog and as such macro-recordable as usual?
>
> I plead for compatibility with the convenient GenericDialog
functionality.
>
> Regards
>
> Herbie
>
> :::::::::::::::::::::::::::::::::::::::::::
> Am 24.09.19 um 18:21 schrieb Curtis Rueden:
>> Hi,
>>
>>> I would also like to have more functionality for additional buttons
>>
>> ImageJ2-style Command plugins support any number of extra buttons with
>> syntax:
>>
>> import org.scijava.widget.Button;
>> ...
>> @Plugin(type = Command.class)
>> public class MyCommandWithHelp {
>> ...
>> @Parameter(label = "Help", callback = "help")
>> private Button helpButton;
>> ...
>> private void help() {
>> System.out.println("Help button pressed.");
>> }
>> ...
>> public void run() {
>> System.out.println("Command executing");
>> ...
>> }
>> ...
>>
>> See here for a demo of SciJava parameters in action (though not a lot of
>> extra buttons):
>>
https://github.com/imagej/tutorials/blob/27d059117b3bfd1c73d8300f3193db11f6aebb9d/maven-projects/widget-demo/src/main/java/WidgetDemo.java#L244-L245 >>
>> Regards,
>> Curtis
>>
>> --
>> Curtis Rueden
>> Software architect, LOCI/Eliceiri lab -
https://loci.wisc.edu/software >> ImageJ2 lead, Fiji maintainer -
https://imagej.net/User:Rueden >> Have you tried the Image.sc Forum?
https://forum.image.sc/ >>
>>
>>
>> On Tue, Sep 24, 2019 at 6:05 PM Michael Schmid <
[hidden email]>
>> wrote:
>>
>>> Hi Philippe,
>>>
>>> yes, I would also like to have more functionality for additional
>>> buttons, and I am sometimes "misusing" the "No" button for such
purposes.
>>>
>>> In your sample code, after gd.showDialog() I think that the code will
>>> never again be able to react to the dialog, even if the dialog remains
>>> on the screen?
>>>
>>> So I think we need some callback, using the DialogListener and/or
>>> ActionListener interface.
>>>
>>> So my dream would be a GenericDialog method
>>> Button[] addBottomButtons(String[] buttonLabels)
>>> which adds one or more buttons at the position where usually the 'no'
>>> button would appear.
>>> Or, alternatively,
>>> Button addBottomButton(String buttonLabel)
>>> which could be called multiple times (the buttons would go into a
Vector
>>> or ArrayList)
>>>
>>> Then the user plugin could either use the references to the buttons and
>>> register as an ActionListener for them, or it could register as
>>> DialogListener and it would get its dialogItemChanged method called
when
>>> the user presses a button while the dialog window is still open.
>>>
>>> Of course, the same could be done already now by adding a panel
with the
>>> buttons, and registering for each of them as ActionListener, but
that is
>>> more cumbersome, and in many cases one wants the button(s) at the
bottom.
>>>
>>> (unfortunately, I can't quickly do the coding now; too much unfinished
>>> work on my desk)
>>>
>>>
>>> Michael
>>> ________________________________________________________________
>>> On 24.09.19 17:09, CARL Philippe (LBP) wrote:
>>>> Dear all,
>>>> Within the GenericDialog class it is now possible to add an additional
>>> button and even customize its name (see
enableYesNoCancel(java.lang.String
>>> yesLabel, java.lang.String noLabel) method).
>>>> Nevertheless, it would additionally be interesting to have this custom
>>> "No" button being able to launch a method without launching itself the
>>> GenericDialog dispose() method, for example for having an "Apply"
button
>>> which would not close the dialog like I illustrated it within the small
>>> plugin that can be found here:
>>>>
http://punias.free.fr/ImageJ/test/My_Plugin.java >>>> that can be linked with the GenericDialog update try that can be found
>>> within:
>>>>
http://punias.free.fr/ImageJ/test/GenericDialog.java >>>> Nevertheless I don't know how I could define the method I would
like to
>>> launch from "outside" the GenericDialog class.
>>>> I thank you very much in advance for your lighting on this.
>>>> My best regards
>>>> Philippe
>>>>
>>>> Philippe CARL
>>>> Laboratoire de Bioimagerie et Pathologies
>>>> UMR 7021 CNRS - Université de Strasbourg
>>>> Faculté de Pharmacie
>>>> 74 route du Rhin
>>>> 67401 ILLKIRCH
>>>> Tel : +33(0)3 68 85 41 84
>>>>
>>>> --
>>>> 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 >>
>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html