Login  Register

Re: Manual choice within a GenericDialog

Posted by CARL Philippe (LBP) on Jul 05, 2020; 7:59pm
URL: http://imagej.273.s1.nabble.com/Manual-choice-within-a-GenericDialog-tp5023615p5023621.html

Der Kenneth,
I validate your suggestion which is actually what I had described as well.
But since then my thoughts evolved and it is possible to make a slight improvement to such a code by getting a handle to the String Field item (following the Choice item) through something like:
        Component[] dlgItems = gd.getComponents();
and then play with:
        dlgItems[i].setVisible( state );
        dlgItems[i].setEnabled( state );
(state being then equal to true or false), as it had been suggested to me by Herbie.
Take care,
Philippe

----- Mail original -----
De: "Kenneth Sloan" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Dimanche 5 Juillet 2020 20:31:42
Objet: Re: Manual choice within a GenericDialog

As I understand the question - and given that you prefer to not open a second dialog - I would create a dialog with a Choice field *and* a following String field.  If the user selects one of the pre-programmed Choices, you simply ignore the String.  

This isn't quite as nice looking as allowing the user to type into the Choice field, but it seems close enough.

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html