Working with Script Widgets

A script widget is a screen action element that allows you to insert custom HTML, Cascading Style Sheet (CSS), or scripting language code in the default code of a screen action to customize the default appearance and behavior of a screen used in a simulation.

Note: The use of script widgets requires knowledge of HTML, CSS, and/or a scripting language. Improperly adding custom code to a screen layout may cause errors when running the simulation.
There are two types of script widgets:
Page Script
A script widget containing position-independent HTML, CSS, or scripting language code that is applied to the entire page of a screen action. For example, you could use a page script widget to add CSS code that formats the appearance of UI elements appearing in the screen action.
UI Widget
A script widget containing position-specific HTML, CSS, or scripting language code that is inserted in the default code of a screen layout. UI widgets include coordinates that allow you to precisely position UI elements in a screen action. For example, you could add an HTML form button to the bottom of a screen action by specifying the desired X and Y coordinates.

Script Widgets Example

The following HTML code inserted in a page script widget adds CSS formatting to the code of the default screen action:

<style type="text/css">

input.mybutton
{
   font-size:16px;
   font-family:Times New Roman,serif;
   font-weight:bold;
   width:102px;
   height:26px;
   background-color:#FFFFFF;
   background-image:url(mybutton.gif);
   border-style:solid;
   border-color:#999999;
   border-width:1px;
}

</style>
The following HTML code inserted in a UI widget adds an HTML submit button that inherits the CSS formatting defined in the previous page script widget:
<input
   type="submit"
   name="mybtn1"
   class="mybutton"
   value="Click Me"
   title="HelloWorld !"
/>