<widgetdescriptor id="template" name="test">
<!-- CONFIG -->
<!-- The Config section determines what the user can configure when they
double-click on the widget in PanelBuilder mode -->
<config>
<!-- CONFIGURATION PARAMETERS GO HERE -->
<!-- These parameters are accessible to your widget, but will also show up
when the user double clicks on the widget to configure it. -->
<params>
<param access="1" maxlength="0" name="Label Name" oid="displayname" type="STRING" value="" widget="text"/>
<param access="1" maxlength="0" name="Number Style" oid="numstyle" type="STRING" value="bg#ff0000" widget="style"/>
</params>
<!-- OPTIONAL - CONFIGURATION LAYOUT GOES HERE -->
<!-- If you need a layout other than the default for the configuration parameters,
put an <oglml></oglml> section here. That section will appear
when the user double clicks on the widget to configure it. -->
</config>
<!-- OGLML -->
<!-- The oglml section determines what the user sees in the widget -->
<oglml>
<!-- the oglml section can have a meta section to define internal parameters, api, style, etc -->
<meta>
<!-- INTERNAL PARAMETERS -->
<!-- These parameters are available within your widget. A copy of these will be created
for each instance of the widget you create in your panel. -->
<params>
<param access="1" name="baseoidPlus1" oid="baseoidPlus1" precision="0" type="INT16" value="1" widget="default"/>
</params>
<!-- INTERNAL API FUNCTIONS -->
<!-- These functions are available thin your widget, but not outside the widget
(see later section for an external API)
Replace the following functions with your own if you need internal functions. -->
<api>
function onLoad() {
ogscript.debug("Loading widget");
params.setValue("baseoidPlus1", 0, params.getValue("%baseoid%", 0) + 1);
}
onLoad();
</api>
<!-- COLORS AND STYLE TAGS -->
<!-- If you want to define colors and styles tags for your widget, they go here. -->
<color id="mainGUI" value="#orange"/>
<style id="round" value="bg#mainGUI;look:round;bdr:round;"/>
<!-- LISTENERS -->
<!-- If your widget needs a listener, it goes here. -->
</meta>
<!-- MAIN ABS -->
<!-- This is the content portion. Keep the toplevel abs which is the next line
and put all your content within it. -->
<abs bottom="0" left="0" right="0" top="0">
<!-- EXTERNAL API -->
<!-- These functions can be called from outside the widget with:
var widget = ogscript.getComponentsById("id_of_panel_component_for_widget")[0];
widget.call('changeColor', ['arg1', 'arg2']);
Replace the following functions with your own if you need external functions.
-->
<api>
function changeColor(args) {
var background = args[0];
var foreground = args[1];
ogscript.debug("Changing the color to " + background + " , " + foreground);
ogscript.setStyle(".param", "bg#" + background + ";fg#" + foreground);
ogscript.setStyle("param", "bg#" + background + ";fg#" + foreground);
}
function outputBaseOID() {
var self = ogscript.getAttribute("widget");
ogscript.debug("baseoid is " + self.getBaseOid() );
}
</api>
<!-- TIMERS -->
<!-- If your widget requires timers, they go here -->
<!-- ACTUAL CONTENT -->
<!-- Replace the following lines with your widget content -->
<simplegrid bottom="0" cols="2" left="0" right="0" top="0">
<label name="widget title"/>
<param oid="displayname" style="bg#green"/>
<label name="%baseoid%"/>
<param oid="%baseoid%" widget="spinner">
<task>params.setValue("baseoidPlus1", 0, params.getValue("%baseoid%", 0) + 1);</task>
</param>
<label name="internal param"/>
<param id=".param" oid="baseoidPlus1" widget="spinner"/>
</simplegrid>
<!-- OTHER THINGS TO DO -->
<!-- 1. Change the ID and Name of the widget in the toplevel <widgetdescriptor> tag -->
<!-- 2. If the panel you are copying into this widget uses ogscript.getObject
or ogscript.putObject, replace them with something like:
var self = ogscript.getAttribute("widget");
self.putObject("key", value);
This will keep the data within the widget. -->
<!-- 3. If you want to use the value of your config params in your widget, you can use
%value[paramname][0]% instead. For example, in a listener, you could use:
<listener connecthost="%value[host][0]%" connectport="%value[port][0]%" delimitertype="newline" id="vlc">.
-->
<!-- 4. Once you are done, to use the widget you can:
A) Place this file in the c:/DashBoard/widgets folder
(or wherever your DashBoard is installed)
B) If the widget is only used in one panel, copy this entire
<widgetdescriptor> tag, and place it in a <widgets></widgets>
in the toplevel <meta></meta> section of your panel.
-->
</abs>
</oglml>
</widgetdescriptor>