http://imagej.273.s1.nabble.com/Dialog-addRadioButtonGroup-labels-alignment-tp5020956p5020986.html
Just one thing to keep in mind, these scripts work in Fiji, not in ImageJ1.
It's indeed more concise to use script parameters to generate dialogs and also more control over how dialogs look like. And lastly can i ask where can I see more examples or tutorials of using these scripts?
> Dear Kaiming,
>
> there's no way to combine script parameters and those created by the
> Dialog.* macro functions into the same dialog. But you can switch your
> whole script to using script parameters, thus saving a few lines and
> hopefully making your code more concise.
>
> Here's an example:
>
> #@script (name="Operating system and ImageJ", menuPath="") #@ String
> (visibility=MESSAGE, persist=false, required=false, label=" ",
> value="Choose ImageJ version and operating system") msg #@ String
> (choices={"FIJI", "ImageJv1.52e", "ImageJ v1.52a to ImageJ
> v1.52e","ImageJv1.50 to ImageJ v1.51 to ImageJ v1.52e"},
> style="radioButtonVertical") versions
> #@ String (label="Operating system:", choices={"Windows", "Mac",
> "Linux"}) os
>
> print(versions);
> print(os);
>
>
> Cheers
> Jan
>
>
> On 19.07.2018 05:47, Kaiming Yin wrote:
>
>> Dear Jan,
>>
>> Thanks again for your help. Yes it works and I get the value from the
>> parameter 'versions' directly. However, when I put the one line
>> script into the whole script which was supposed to generate one panel
>> providing all options for user to choose from, this one line script
>> seems to generate one panel for its own seperately and the other
>> commands will be in the other panel. see the example below and attached two images:
>>
>> Dialog.create("Operating system and ImageJ");
>> Dialog.addMessage("Choose ImageJ version and operating system"); #@
>> String (choices={"FIJI", "ImageJv1.52e", "ImageJ v1.52a to ImageJ
>> v1.52e","ImageJv1.50 to ImageJ v1.51 to ImageJ v1.52e"},
>> style="radioButtonVertical") versions Dialog.addChoice("Operating
>> system:", newArray("Windows", "Mac", "Linux")); Dialog.show();
>> print(versions);
>>
>> Can I ask do you know if it's possible to put two GUIs together as a
>> whole panel?
>>
>> Thanks,
>> Kaiming
>>
>> On 18 July 2018 at 22:46, Jan Eglinger <
[hidden email] <mailto:
>>
[hidden email]>> wrote:
>>
>> Dear Kaiming,
>>
>> On 18.07.18 21:31, Kaiming Yin wrote:
>>
>> Your are right. It looks nice with the String type in Linux FIJI
>> too (see
>> attached image).
>>
>> Can I ask in this case how do I output the value users choose
>> from this
>> panel? Dialog.getRadioButton() seems not working for it any more.
>>
>>
>> No need to call a Dialog function. The user's choice will be in that
>> variable (named 'versions' in my example).
>> Just try adding in another line:
>>
>> print(versions);
>>
>>
>> Also do I need to put a semicolon behind this single line? Both
>> worked well
>> with or without in Linux FIJI. Just not sure should I or not.
>>
>>
>> You don't need to put a semicolon. Script parameters are processed
>> by the SciJava framework _before_ the script is executed. They are
>> therefor language-agnostic and work the same in any supported script
>> language.
>>
>> Hope that helps,
>> Jan
>>
>>
>>
>>
>>
>> On 18 July 2018 at 07:53, Jan Eglinger <
[hidden email]
>> <mailto:
[hidden email]>> wrote:
>>
>> Dear Kaiming,
>>
>> would you mind trying if using script parameters [1] works
>> for you in
>> Linux?
>>
>> Using the following in any script (in a single line):
>>
>> #@ String (choices={"ImageJ", "ImageJv1.52e", "ImageJ
>> v1.52a to ImageJ
>> v1.52e","ImageJv1.50 to ImageJ v1.51 to ImageJ v1.52e"},
>> style="radioButtonVertical") versions
>>
>> will generate a dialog similar to yours (see attachment).
>>
>> Cheers
>> Jan
>>
>> [1]:
https://imagej.net/Script_Parameters>> <
https://imagej.net/Script_Parameters>
>>
>>
>>
>> On 17.07.2018 18:29, Kaiming Yin wrote:
>>
>> I tried without spaces, and in Linux-FIJI it looks like
>> to align the
>> labels
>> centrally, see attached image.
>>
>> Thanks,
>> Kaiming
>>
>> On 17 July 2018 at 17:19, Straatman, Kees (Dr.)
>> <
[hidden email] <mailto:
[hidden email]>>
>> wrote:
>>
>> If you want to align to the left, just delete all the
>> spaces
>>
>>
>> Dialog.create("Different ImageJ versions");
>> Dialog.setInsets(0, 20, 0);
>> items = newArray("ImageJ", "ImageJv1.52e", "ImageJ
>> v1.52a to ImageJ
>> v1.52e","ImageJv1.50 to ImageJ v1.51 to ImageJ
>> v1.52e");
>> Dialog.addRadioButtonGroup("Versions:", items, 4,
>> 1,"ImageJ");
>> Dialog.show();
>>
>>
>> Best wishes
>>
>> Kees
>>
>> -----Original Message-----
>> From: Kaiming Yin [mailto:
[hidden email]
>> <mailto:
[hidden email]>]
>> Sent: 17 July 2018 17:00
>> To:
[hidden email] <mailto:
[hidden email]>
>> Subject: Re: Dialog.addRadioButtonGroup labels
>> alignment
>>
>> Dear Kees,
>>
>> Thanks for your reply and I also want to align all
>> menu labels to the
>> left.
>> I don't know how to do it with Linux version FIJI
>> and the only way I see
>> is to add spaces to adjust the positions of labels
>> little by little which
>> is time consuming. So I wonder if there are any
>> parameters which can
>> define
>> the position/alignment of labels in ButtonGroup or
>> even other similar
>> tools
>> which need a list of labels too?
>>
>> Thanks,
>> Kaiming
>>
>> On 17 July 2018 at 16:51, Straatman, Kees (Dr.)
>> <
[hidden email]
>> <mailto:
[hidden email]>>
>>
>> wrote:
>>
>> Dear Kaiming,
>>
>>
>> Do you want to centre the menu labels, as that
>> is what your image shows
>> ?
>>
>> It seems there is a difference in the way the
>> menu is displayed in
>> Windows compared to Linux. In Windows (same
>> versions as you use) the
>> spaces have no effect on the menu labels as I
>> showed in my previous
>> post, only the title "Versions" is positioned
>> different when the
>> spaces are there compared with code without
>> spaces. All menu labels
>> are aligned to the left (and I must say I also
>> would prefer this).
>>
>> Best wishes
>>
>> Kees
>>
>>
>> Dr Ir K.R. Straatman
>> Senior Experimental Officer
>> Advanced Imaging Facility
>> Centre for Core Biotechnology Services
>> University of Leicester
>> www.le.ac.uk/advanced-imaging-facility
>>
>> <
http://www.le.ac.uk/advanced-imaging-facility>
>>
>>
>> -----Original Message-----
>> From: Kaiming Yin
>> [mailto:
[hidden email]
>> <mailto:
[hidden email]>]
>> Sent: 17 July 2018 15:53
>> To:
[hidden email] <mailto:
>>
[hidden email]>
>> Subject: Re: Dialog.addRadioButtonGroup labels
>> alignment
>>
>> Dear Kees,
>>
>> Sorry for my unclear question. Here I attach the
>> command lines I ran
>> in a macro in FIJI and also the output panel in
>> attached image. I'm
>> running Ubuntu 18.04 and FIJI version is ImageJ
>> 2.0.0-rc-68/1.52e;
>> java 1.8.0_66 [64-bit].
>>
>> Command lines in macro:
>>
>> Dialog.create("Different ImageJ versions");
>> Dialog.setInsets(0, 20, 0);
>> items = newArray("ImageJ
>> ", "ImageJ
>> v1.52e ", "ImageJ v1.52a to
>> ImageJ v1.52e ", "
>>
>> ImageJ
>>
>> v1.50 to ImageJ v1.51 to ImageJ v1.52e");
>> Dialog.addRadioButtonGroup("
>> Versions:", items, 4, 1,
>> "ImageJ ");
>> Dialog.show();
>>
>> Thanks,
>> Kaiming
>>
>> On 17 July 2018 at 08:44, Straatman, Kees (Dr.)
>> <
[hidden email] <mailto:
>>
[hidden email]>>
>> wrote:
>>
>> Dear Kaiming,
>>
>>
>> Not sure what the problem is. Without all
>> the spaces the labels
>> align to the left as well see attached image.
>>
>> Kees
>>
>> -----Original Message-----
>> From: Kaiming Yin
>> [mailto:
[hidden email]
>> <mailto:
[hidden email]>]
>> Sent: 16 July 2018 18:42
>> To:
[hidden email]
>> <mailto:
[hidden email]>
>> Subject: Dialog.addRadioButtonGroup labels
>> alignment
>>
>> Dear guys,
>>
>> Can I ask if I want to add a
>> Dialog.addRadioButtonGroup in my panel,
>> and the button group has four choices with
>> labels at different
>> lengths for each choice. How can I align the
>> four labels to the left
>> in one
>>
>> column please?
>>
>> For example, currently I'm using command
>> lines as below:
>>
>> items = newArray("ImageJ
>> ", "ImageJ
>> v1.52e ", "ImageJ v1.52a to
>> ImageJ v1.52e ", "
>>
>> ImageJ
>>
>> v1.50 to ImageJ v1.51 to ImageJ v1.52e");
>>
>> Dialog.addRadioButtonGroup("
>> Versions:", items, 4, 1,
>> "ImageJ ");
>>
>> Currently I use spaces to try to align all
>> the labels but seems
>> quite clumsy. Is there any other way to
>> do this?
>>
>> Thanks,
>> Kaiming
>>
>> --
>> ImageJ mailing list:
>>
http://imagej.nih.gov/ij/list.html>> <
http://imagej.nih.gov/ij/list.html>
>>
>> --
>> ImageJ mailing list:
>>
http://imagej.nih.gov/ij/list.html>> <
http://imagej.nih.gov/ij/list.html>
>>
>>
>> --
>> ImageJ mailing list:
>>
http://imagej.nih.gov/ij/list.html>> <
http://imagej.nih.gov/ij/list.html>
>>
>> --
>> ImageJ mailing list:
>>
http://imagej.nih.gov/ij/list.html>> <
http://imagej.nih.gov/ij/list.html>
>>
>>
>> --
>> ImageJ mailing list:
>>
http://imagej.nih.gov/ij/list.html>> <
http://imagej.nih.gov/ij/list.html>
>>
>> --
>> ImageJ mailing list:
>>
http://imagej.nih.gov/ij/list.html>> <
http://imagej.nih.gov/ij/list.html>
>>
>>
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>> <
http://imagej.nih.gov/ij/list.html>
>>
>>
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>> <
http://imagej.nih.gov/ij/list.html>
>>
>>
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>> <
http://imagej.nih.gov/ij/list.html>
>>
>>
>>