With the Text Widget, you can show text in the WebUI, style it, insert images in between and around it and let the text or images link to other pages, both internal and external.
An example of what a text widget could look like can be seen below.
Firstly, the image must be placed into the WebUI/resources/images sub-folder of your MainProject directory. To insert an image, click on the ‘Image’ button and copy the complete image name (including the image type/file extension) into the box that pops up. If done correctly, you should be able to see a preview of the image. Then click ‘Insert’ to insert the image into the text box.
Please keep in mind that on Linux the casing of the image files should be correct, otherwise your images will not display. Also, please remember to specify the full name of the image, including the filename extension (like .jpg, .png etc). In particular, this is important to keep in mind in case your Windows Explorer is set to hide file extensions.
Specifying a string parameter in Contents
String parameter in contents is available in software versions from AIMMS 4.79 onwards.
You can specify a string parameter in the contents to display text that changes based on either the current page or some other condition. This is very similar to specifying a string parameter in a scalar widget with the multi-line option, but with the advantage of using HTML content. This allows you to style the text, add images, hyperlinks, and a lot of other options that come with HTML formatting.
The text widget is a rich text editor and does not support the complete list of tags or styles that an HTML document would provide. For example, the text widget does not support the
<table> tag, meaning you cannot add tables to the HTML you wish to include in the text widget. The rich text editor will support any text formatting and some basic HTML styles.
You can add a string parameter by opening the Identifier Selector by clicking the button next to the contents field and selecting the identifier you want to specify as the contents.
Specifying the string parameter
s_HTMLText with the below data,
"<div style=\"text-align: center;\"><span style=\"font-size: 32px;\"><u><i>Centered Heading</i></u></span></div><div><br></div>" "<div>This is an example of specifying a string parameter with <b>HTML content that has different styles </b>in a" "<span style=\"background-color: rgb(255, 255, 0);\">Text widget</span>. </div><div><br></div><div><i>You can also add images:</i></div>" "<div><img src=\"/app-resources/resources/images/SmallImage.jpg\"></div><div style=\"text-align: center;\"><br></div><div><br></div>" "<div>You can add numbered lists or bulleted lists</div><ol><li>Point no 1</li><li><s>Point no 2 is struckout</s></li>" "<li><u>I want to underline this point</u></li></ol>" ;
The Text widget supports a scalar string or a scalar slice of an indexed string parameter, as illustrated below. The string parameter
s_myHelpText(webui::arp) is sliced over the element parameter
ep_currentPageId ranged over the
You can edit the contents of the string parameter by clicking on the edit button. After making the edits either click on the
Save and Close “x” icon, or click the save icon.
When you have added content as a “Definition” to the string parameter, you will not be able to edit the content in the WebUI. The Edit button will be disabled.
When reading from a file or adding HTML content to the string parameter ensure that the quotes used in style tags are escaped e.g.,
When reading from a file and defining content for the string parameter, we strongly recommend you set
NoSave to the
Property attribute. This will ensure that the text is not stored in the case files, which would unnecessarily increase the size of the case file.