Subscribe

Wednesday 24 February 2010

Widget Configurations


Hello there everybody, today I am going to talking about the configuration file for you widget under Yahoo Konfabulator.
Every widget may have few properties which are more to do with configuration rather than actual code or design. The best similarity which I can think of is the web.config file of .net appllications. To give you an idea the best example will be the icon which is showed on the yahoo dock for your widget and the icon showed on the security window when you run the widget for the first time.
The picture below shows an example of the window and the dock with a custom icon which I have created for a simple widget.

the second place where you will see this icon will be on the yahoo dock on your screen. The style and placement may differ according to your machine.

From version 4.0 onward the metadata or the data about your widget is stored in a separate file called widget.xml which should be placed with your kon file on the same path. This file deals with all the metadata elements of your widget. Lets start by looking at the simple structure of this file. Please remember this is an XML file thus all the rules of XML apply.
So metadata is the root element of this document, now I will show you how to put an icon in the Dock.
Yahoo specified that the icon to be shown in the dock must be 75*70 pixel. Thus i created the icon(png image) in photoshop shown below



As you can see my designing skills are nothing to be talked about you are free to use any style of designing you wish just remember the size. Now we place the icon reference in one of the elements called image with the usage attribute as dock eg
<img src="Resources/dockIcon.png" usage="dock" />
The widget automatically looks for this file and uses it if it is present.
If you want to give your widget a proper name with copyright notice and author name etc, again this file is the best place to put these informations

<?xml version="1.0" encoding="utf-8"?>
<metadata>
<version>1</version>

<name>ModernRSS</name>

<mage usage="dock" src="Resources/dockIcon.png"/>
<image usage="security" src="Resources/dockIcon.png"/>

<author name="Sudeep Mukherjee" organization="DigitalDreams" href="http://widgetsgadgetsworld.blogspot.com/"/>

<copyright>(c) 2010-2012 sudeep.</copyright>

<description>

A simple RSS news Widget
</description>

<platform minVersion="4.5" os="windows"/>

</metadata>

You can customize all these options according to your need.
Another interesting tit-bit you might be interested in is the debug option, say you are trying out your widget and would like an option to run the widget without actually closing it and loading it again and going through the security screen each time you do it. Or you want to have a look at some variables during the execution or see some special messages while the widget executes. We all developers from time to time use these kind of facilities provided by modern compilers and IDE's. Therefore Yahoo provides a debug mode for you. To switch on the debug mode make the following changes to your kon file or main widget file

<?xml version="1.0" encoding="UTF-8"?>
<widget minimumVersion="4.5">
<settings>

<setting name="debug" value="on"/>

      </settings>
</widget>


If you have any queries please send me comments or mails, and do not forget to check my you tube video for the same.



No comments:

Post a Comment

 
EatonWeb Blog Directory