http://imagej.273.s1.nabble.com/No-button-within-GenericDialog-class-feature-update-tp5022458p5022471.html
I will inspire from your Plot>>More>>Contents_style... code and will more than probably be able to solve my issue.
Thanks a lot for your replies and have a nice day.
commands would then go into the DialogItemChanged method of your plugin.
DialogListner interface...
> Dear Michael,
> I had missed to answer your following question:
>
>> 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?
>
> The code is reacting as I expected it.
> Indeed, if you look at the line 1388 of the modified version of the GenericDialog code I had put under :
>
http://punias.free.fr/ImageJ/test/GenericDialog.java> I had written:
> if (source==okay || source==cancel | source==no) {
> wasCanceled = source==cancel;
> wasOKed = source==okay;
> if(source==no && noDispose) {
> wasOKed = false;
> IJ.log("not disposing the window");
> ImagePlus impTest = IJ.openImage("
http://wsr.imagej.net/images/AuPbSn40.jpg");
> impTest.show();
> } else
> dispose();
> }
> And the following written code:
> IJ.log("not disposing the window");
> ImagePlus impTest = IJ.openImage("
http://wsr.imagej.net/images/AuPbSn40.jpg");
> impTest.show();
> can be run several times as I wanted it.
> Nevertheless, the "wished launched code" has to be written within the GenericDialog class which makes it non suitable.
> Thus, what would just be needed is to have the possibility to pass the pointer to a void defined outside the GenericDialog class.
> And I'm saying this, since I have already seen such tricky coding in C within the Levmar library (when you are defining the equation to be fitted as well as its jacobians):
>
http://users.ics.forth.gr/~lourakis/levmar/> But such advanced coding is way beyond my coding level either in C or in Java...
> kindest regards,
> Philippe
>
> ----- Mail original -----
> De: "Michael Schmid" <
[hidden email]>
> À: "imagej" <
[hidden email]>
> Envoyé: Mardi 24 Septembre 2019 18:02:47
> Objet: Re: "No" button within GenericDialog class feature update
>
> 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>