GenericDialog components text to be or not to be enabled

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GenericDialog components text to be or not to be enabled

CARL Philippe (LBP)
Dear all,
For a given application, I need to disable (i.e. by using ".setEnabled(false);") some GenericDialog components.
And when I'm doing so, the checkboxes and the text associated to them become grey (as I expect it).
But this isn't the case with the texts associated to the TextFields, Sliders and Choices (i.e. only the TextFields, Sliders and Choices contents become grey and inactive but not the text linked to them).
Thus could there be done something so that the texts associated to all GenericDialog components become grey when disabled (whatever type they are)?
I thank you very much in advance for your lighting on this and wish you a nice end of week-end!
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 42 89

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: GenericDialog components text to be or not to be enabled

Wayne Rasband-2
> On Jun 21, 2020, at 10:05 AM, CARL Philippe (LBP) <[hidden email]> wrote:
>
> Dear all,
> For a given application, I need to disable (i.e. by using ".setEnabled(false);") some GenericDialog components.
> And when I'm doing so, the checkboxes and the text associated to them become grey (as I expect it).
> But this isn't the case with the texts associated to the TextFields, Sliders and Choices (i.e. only the TextFields, Sliders and Choices contents become grey and inactive but not the text linked to them).
> Thus could there be done something so that the texts associated to all GenericDialog components become grey when disabled (whatever type they are)?

Use use the getLabel() method to get a reference to the label of the most recently added TextField, Slider, Choice, etc. Here is a JavaScript example:

  gd = new GenericDialog("Test");
  gd.addStringField("Text: ", "abc");
  gd.getLabel().setEnabled(false);
  gd.addChoice("Choice:",["a","b","c"],"a");
  gd.getLabel().setEnabled(false);
  gd.addSlider("Slider", 0, 100, 50);
  gd.getLabel().setEnabled(false);
  gd.showDialog();

-wayne

 

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