Making Widgets (Medium)
( 1 Vote )
Hits smaller text tool iconmedium text tool iconlarger text tool icon
In this tutorial we will see how to create widgets. In order to understand it you must have some knowledge of Throttlelauncher Skining.

Widgets are items that are theme independent. This means that they can be used in any theme you want as long as the theme has the hability to use them or the apropiate widget import.

Tip: in order for your widgets to move you must have it added to a row with advancedevents="true"

The main layout of a widget is:

1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="utf-8"?>
<panel name="WIDGETNAME">
<event type="MouseDown">
<action execute=":Script"
parameters="WIDGETNAME:Set(MoveLock,true)"/>
</event>
...
</panel>


It's very important that the WIDGETNAME is the same as the folder name where it is included.

As you can see in the code above, the widget is just a panel that defines the MouseDown event in order to enable movement. Inside that panel we can place any item like icons, texts or other panels and rows. Note that if you include rows the widget will not be movable unless you leave a blank space or icon where the user can drag.

Tip: if you don't specify the widget size it will fit it's contents!

A simple example of a widget displaying an icon could be:

1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="utf-8"?>
<panel name="WIDGETNAME">
<event type="MouseDown">
<action execute=":Script"
parameters="WIDGETNAME:Set(MoveLock,true)"/>
</event>
<icon X="0" Y="0"
path="/portal/Tutorials/ThrottleLauncher/making_widgets_medium/index.html"/>
</panel>


You can use the same syntax inside a widget than in a ThrottleLauncher page making it possible to read registry values, systemstate items or variables. Note that is strongly not recomended to comunicate widgets or use theme variables inside them.

Now that we know how to code the widgets we can try to make them configurable. Widgets can have their own config dialog just like a theme does. In order to have that we have to use the following configuration element inside the main panel tag:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<configuration name="WIDGETNAME"
description="Widget for ThrottleLauncher"
minthrottleversion="0.9.6"
comments=""
createdby="">
<variables>
<!-- see the theme template tutorial example
for a list of types -->
<var name="My_separator"
description="#L:Seaprator#"
default="" type="separator" />
<var name="MyVar"
description="#L:Var#"
default="" type="string"/>
</variables>
</configuration>


Again it's really imnportant to ensure that the WIDGETNAME equals to the panel name.

After this we can use the defined variable by using hte WIDGETNAME as prefix as follows:

1
2
<icon X="0" Y="0" 
path="/portal/Tutorials/ThrottleLauncher/making_widgets_medium/index.html"/>


If you create some widgets and want to share please feel free to post them at the widgets section of this web.

Comments (0)
Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:D:angry::angry-red::evil::idea::love::x:no-comments::ooo::pirate::?::(
:sleep::););)):0
Security
Please input the anti-spam code that you can read in the image.
 
Follow us on Twitter

Top rated Skins

  • Screenshots
  • Screenshots
  • Screenshots
  • Screenshots
  • Screenshots

Login