Posted by
Michael Schmid on
Feb 09, 2018; 1:58pm
URL: http://imagej.273.s1.nabble.com/grid-setConstraints-issue-with-Choice-tp5020048p5020050.html
Hi Philippe,
if you look at the GenericDialog addChoice code, you will see that the
Label and the Choice are two separate components.
Unfortunately, one can't access the Label directly (the reference to it
is not kept, so there is nothing like the gd.getChoices() for the Label).
Possible solutions:
- stick to the layout of the GenericDialog, with vertical alignment, or
- have your own dialog (if you don't need interaction with macros), or
- persuade Wayne to add something like a
GenericDialog.addToLine(boolean) method, and for all 'add's have
if (addToLine)
y++; c.gridy = y;
else
c.gridx = 0; c.gridy = y;
(roughly 10 occurrences)
Michael
________________________________________________________________
On 09/02/2018 12:50, CARL Philippe (PHA) wrote:
> Dear all,
> I'm using the following code:
> gd.addChoice ("Young's_modulus_(in Pascal)" , EText , EText[EIndex]);
> gd.addChoice ("Regularization_factor" , lambdaText, lambdaText[lambdaIndex]);
> ........
> comp = (Component) gd.getChoices().get(1);
> cst = grid.getConstraints(comp);
> cst.gridx = cst.gridx + 1;
> cst.gridy = cst.gridy - 1;
> grid.setConstraints(comp, cst);
> in order to shift position of a Choice within a GenericDialog.
> But as can be seen within the following PrintScreen of the launched plugin, the Choice dropdown menu gets well shifted but not the text associated to it (which stays in its attributed position when declared):
>
http://punias.free.fr/ImageJ/create_job.jpg> Am I doing something wrong here (knowing that a similar code applied on CheckBoxes is working well) or is there a stecific issue when applied on Choices?
> I thank you very much in advance for your suggestions and help.
> My best egards,
> Philippe
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html