Dialog Box Not interactive

dialog
imagej
macro

#1

Hi there

I have an issue with Dialog box containing a Message, 2 Numbers, 2 Sliders and 2 Radio button.

The dialog display correctly and all works fine at the exception of sometimes the number box is not editable. It is visible but we can’t click nor edit it.

The only way to make it editable is to select another program than ImageJ and then bring back ImageJ to the front.

Is it a OS windows management issue (MacOS)?
Any suggestions would be appreciated.

nico


#2

I didn’t see any issues on Mac OSX when testing with this macro:

// @String(value="Please set some parameters", visibility="MESSAGE") text
// @int(label="Some integer number") a
// @int(label="A slider-controlled value", min=0, max=100, style="slider") b
// @int(label="A scrollbar-controlled value", min=0, max=100, style="scroll bar") c
// @double(label="Some floating point number") d
// @String(label="Some button choices", choices={"First", "Second", "Third"}, style="radioButtonHorizontal") choice

print("You entered a=" + a + ", b=" + b + ", c=" + c + ", d=" + d + " and chose the option: " + choice);

Can you post your code, so I can see if I can reproduce the issue?


#3

Hi Jan

Thanks for your reply. Here are two captures
When it is frozen the value in pixel is white:

When it works the pixel appears in blue (selected):

As it works sometimes and some other times not I think it is a matter which window is at the front whenever I call the dialog box. Or maybe if the macro is in batchmode hide when the dialog is brought?

Thanks a lot in advance

The code below:

Dialog.create(PluginName+" Information");
Dialog.setInsets(0, 0, 0);
Dialog.addMessage("Adjust the Cell Detection Parameters for "+NameSelectedChI+" and Try Again.");
Dialog.setInsets(0, 0, 0);
Dialog.addMessage("or Move to Next.");
Dialog.setInsets(0, 0, 0);
Dialog.addNumber("Min Cell Diameter for "+NameSelectedChI+" :", MinParticleDiameterSelectedChI, 0, 10, RescaledUnit)
Dialog.setInsets(0, 0, 0);
Dialog.addNumber("Max Cell Diameter for "+NameSelectedChI+" :", MaxParticleDiameterSelectedChI, 0, 10, RescaledUnit)
Dialog.setInsets(0, 0, 0);
Dialog.addSlider("Min Cell Circularity for "+NameSelectedChI+" :", 0, 100, MinParticleCircularitySelectedChI);
Dialog.setInsets(0, 0, 0);
Dialog.addSlider("Max Cell Circularity for "+NameSelectedChI+" :", 0, 100, MaxParticleCircularitySelectedChI);
Dialog.setInsets(0, 0, 0);
UserChoiceDetectionArray=newArray("Try Again", "Move to Next");
Dialog.setInsets(0, 150, 0);
Dialog.addRadioButtonGroup("", UserChoiceDetectionArray, 2, 1, "Try Again");
Dialog.setLocation(ToolbarPosX, ToolbarPosY+ToolbarSizeY+Spacer+15);
Dialog.show();

#4

Please provide a minimal runnable macro that reproduces this problem. And it would help to know what version of Java you are using and what version of Mac OS X.


#5

Hello Wayne,

Thank you for your reply.

ImageJ version 1.51f
Java 1.8.0_9
OS X 10.11.6

I will trim out the Macro to something workable.


#6

1.8.0_9 is an old and buggy version of Java. Try the current version (1.8.0_101), which is included with the version of ImageJ for OS X bundled with Java 8, available at

https://imagej.nih.gov/ij/download.html

The description says it is Java 1.8.0_91 but it is actually Java 1.8.0_101.


#7

It seems that the problem came from calling:
waitForUser();
Just prior the dialogbox.

the dialogbox was no longer at the front so it was unresponsive.
It was becoming responsive only by going back and forth to another application/

The walk around the issue was to use
selectWindow();
between the waitForUser(); and Dialog.show();

Hope it helps someone in the future :wink:


#8

A post was split to a new topic: Conditional use of script parameters