Login  Register

Strange behavior of Dialog.addMessage vs Dialog.addNumber

Posted by CARL Philippe (LBP) on Oct 23, 2018; 2:51pm
URL: http://imagej.273.s1.nabble.com/Strange-behavior-of-Dialog-addMessage-vs-Dialog-addNumber-tp5021331.html

Dear all,

Please consider the following small macro :

                ParameterValues = newArray(0, 1, 2, 3);

                j = 0;

                Dialog.create   ("Create Settings");

                Dialog.addNumber("Parameter 0", ParameterValues[j++]);
print("a", j);

                Dialog.addNumber("Parameter 1", ParameterValues[j++]);
print("b", j);

                Dialog.addNumber("Parameter 2", ParameterValues[j++]);
print("c", j);

                Dialog.show();

Which is working as I would expect it, with the parameter j incremented by a
value of one at each j++ invocation.

But if I replace the 5th line, i.e. the line:

                Dialog.addNumber("Parameter 1", ParameterValues[j++]);
print("b", j);

by the line:

                Dialog.addMessage("Parameter 1    " + ParameterValues[j++]);
print("b", j);

the value j following the Dialog.addMessage gets incremented not by a value
of 1 but of 2.

Is this a bug or is there an issue in the way I’m trying to write my code?

I thank you very much in advance for your lightings about this question.

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