Posted by
Kenneth Sloan-2 on
Jun 15, 2020; 9:46pm
URL: http://imagej.273.s1.nabble.com/intermittent-problem-with-NonBlockingGenericDialog-tp5023524p5023527.html
Hmmm... when creating the dialog, (blocking or non-blocking) there is no provision to specify the ImageWindow to be used as the parent.
I my plugin, the immediately preceding action is to select a rectangular area. I do this by
IJ.setTool("rectangle")
and then use WaitForUserDialog to instruct the user to select a rectangle. The user creates the rectangle and dismisses the WFUD.
The very next thing is the creation of the NBGD listing a bunch of parameters that he can set (some of these have defaults that may depend on the dimensions of the rectangle).
My point is: the same windows should be active (that is - the relevant Image) when the dialog is created. But, the result differs from time to time.
Most of the time (I think virtually *all* of the time that *I* have tested it) the dialog works perfectly. It comes up with the first data field highlighted, and all fields are editable). SOME of the time (up to 50%, according to my client) the dialog appears with no fields highlighted, and none of the fields can be selected or edited. The dialog can be accepted.
Check that...further testing reveals that the plugin works fine if it is invoked with no open images.
If you run it again (without closing the original image), it fails. So....is the GenericDialog code being confused by the presence of other open ImageWindows?
Further testing - the dialog contains several NumericFields, a "Choice" field, a Checkbox, and the Cancel and OK boxes. When it fails, the NumericFields cannot be highlighted or edited, but the Choice field works (the pulldown menu appears and can be changed) and the Checkbox can be checked. Both the Cancel and OK boxes work. The only failure is in the NumericFields!
I have made the plugin available on my ImageJ update site, if anyone wants to point and giggle at my code and tell me what I've done wrong. "CreativeComputation" + Area_Fraction_macOSX.jar. All the .java files are in the .jar. Ignore the "macOSX" - it's just documentation of where it was BUILT - it works everywhere. In fact, it works perfectly on a WinDoze machine, but fails (sometimes - apparently when other ImageWindows are present) on a Mac.
For now, I'm going to pursue the advice: "close all open windows before running Area_Fraction" and see how that goes. I welcome comments on any aspect of my .java code - especially those that tell me how to avoid this problem. [well...I could be fascist and close all open ImageWindows as my first action - but that seems draconian]
--
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