I want to present users with a one-of-many type of selection widget, and radio buttons would seem to be the right thing to use. If I was to play with building this, would it belong in GenericDialog where the CheckBox widget is supported? I haven't found any hooks in the source code, but am unsure if I've missed something - would a from-scratch implementation be needed?
Thanks. Bill Christens-Barry -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Bill,
GenericDialog has no Radio Buttons; but you can have a Choice (popup list), which serves the same purpose: Choosing one options out of several possibilities; just that the user does not see all possibilities without clicking on the Choice. Note that GenericDialog.addCheckboxGroup adds an array of individual checkboxes; this is in contrast to java.awt.CheckboxGroup, which behaves like RadioButtons. Michael ________________________________________________________________ On Mar 13, 2013, at 15:37, Bill Christens-Barry wrote: > I want to present users with a one-of-many type of selection widget, and radio buttons would seem to be the right thing to use. If I was to play with building this, would it belong in GenericDialog where the CheckBox widget is supported? I haven't found any hooks in the source code, but am unsure if I've missed something - would a from-scratch implementation be needed? > > Thanks. > > Bill Christens-Barry > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Bill Christens-Barry-2
hey Bill,
the near-equivalent to a radio-button in GenericDialog is the checkbox, but each checkbox acts independent from the others so if you wanted all the other checkboxes to be turned off when the user selects a new one, then you would have to write a short piece of code to turn off all the others when one is selected (what you really want to do is have a function to turn off all checkboxes and that is called first when any checkbox is selected, then turn back on just the one of interest). The other option would be a choice widget, which is a drop-down menu of possible selections wherein only one can selected. And while I have the podium, I'll advertise my GenericRecallableDialog that creates a GenericDialog that remains active to allow for repeated runs through target program, enabling the use of add-on buttons to perform different and repeatable functions. This was part of the WindowLevelAdjuster plugin from several years ago so you can look there for implementation examples. I have an updated version that I can provide to you but it cannot be transmitted through the listserver. -Walter On Mar 13, 2013, at 10:37 AM, Bill Christens-Barry wrote: > I want to present users with a one-of-many type of selection widget, and radio buttons would seem to be the right thing to use. If I was to play with building this, would it belong in GenericDialog where the CheckBox widget is supported? I haven't found any hooks in the source code, but am unsure if I've missed something - would a from-scratch implementation be needed? > > Thanks. > > Bill Christens-Barry > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > Walter O'Dell, PhD Assistant Professor Dept. Radiation Oncology McKnight Brain Inst. Rm LG-177 PO Box 100385 Shands Cancer Center, University of Florida Gainesville, FL 32610 [hidden email] 352-273-9030 http://odell.radonc.med.ufl.edu ___________ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Bill Christens-Barry-2
Thanks, Michael and Walter, for the mention of finer points and alternatives. Choice is what I'll use, as I want only a single item to be selected at the same time and I've used it in a macro before.
Bill -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Bill & everyone,
> I want to present users with a one-of-many type of selection widget, > and radio buttons would seem to be the right thing to use. This question spurred me to add support in ImageJ2 for multiple choice inputs using radio buttons. It already supported dropdown list boxes, but radio buttons are nice alternative widget style in some cases. Here is a simple example with screenshot and code: https://gist.github.com/ctrueden/5162760 I also added an ImageJ Tutorial example demonstrating all the various widgets, which you can find here: https://github.com/imagej/imagej-tutorials/blob/687ee1fd4e/widget-demo/src/main/java/WidgetDemo.java With ImageJ2's declarative command style, you don't have to explicitly create and show dialog boxes (e.g., GenericDialogs) in your run method. You just declare the command's inputs as parameters. Soon we will have support for this declarative syntax in Fiji too, so that you can write ImageJ1 plugins using the @Parameter annotation. We expect this to be particularly useful when prompting for multiple ImagePlus objects, since doing so with GenericDialog is a bit involved. Regards, Curtis On Wed, Mar 13, 2013 at 10:24 AM, Bill Christens-Barry <[hidden email]>wrote: > Thanks, Michael and Walter, for the mention of finer points and > alternatives. Choice is what I'll use, as I want only a single item to be > selected at the same time and I've used it in a macro before. > > Bill > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |