Display text label with @ script parameters

script-parameters
scripting
macro
Tags: #<Tag:0x00007fb87b8b2488> #<Tag:0x00007fb87b8b2320> #<Tag:0x00007fb87b8b21e0>

#1

Hello,
I was wondering if it possible to display a text label using the @script parameters for example to add a link to a wiki page of associated documentation.
I could use a @String but the idea would be to have something immutable. I dont think it is possible currently, possible future improvements ? Eventhough it is not a parameter per see…


#2

Dear @LThomas,

You can use the visibility option for a @Parameter:

#@ String(visibility="MESSAGE", value="Something") somethingString
#@ String(value="Something else") somethingElseString

The first String will be an immutable label, while the second can be changed.

Best,
Stefan


#3

Thanks ! That could be worth adding to the wiki.
Is there some formatting to display hyperlink as well ?


#4

It supports HTML as far as I know. You can try wrapping your text in <html></html> and add a link this way.


#5

Well almost,
# @String(visibility="MESSAGE", value="<html><a href='http://forum.imagej.net/'>This is my link</a></html>") Footer
indeed produce a html-formatted string but the link is not clickable :joy:


#6

Sorry, should have thought about that!

@imagejan: Any idea where an issue for this should live? scijava-ui-swing?


#7

Yes, scijava-ui-swing is the correct repository for this.

The class responsible for displaying messages is SwingMessageWidget, which currently simply generates a JLabel with the text:

There’s some extra logic needed to make links work in JLabels, as discussed e.g. in these stackoverflow posts:

I opened an issue to track this:


#8

Thanks for filing that issue, @imagejan!