Windows Vista supports gadgets; mini-applications you can display on the sidebar or drag to the desktop. Gadgets will also work in Windows 7, now in beta.
They are somewhat improved because they live directly on the desktop and can be displayed at any time using a new desktop peek feature: hover the mouse over the ‘show desktop’ icon at the right end of the Taskbar and application windows become temporarily transparent, letting you inspect any desktop gadgets.
Create a Windows gadget
Gadgets are easy to code and make a fun project. Here is an example called
Countdown.The Countdown gadget is great if you have an important event or
celebration to look forward to. It counts down the remaining days and alerts you
when the moment arrives.
Windows gadgets are HTML applications that consist of two or more files in a folder. In order to be recognised, the folder has to be in a special location. There is a per-machine location and a per-user location, with the latter being the most convenient for development.
Create a folder called countdown.gadget in: ‘%USERPROFILE%\AppData\Local\Microsoft\Windows Sidebar\Gadgets’ where ‘%USERPROFILE%’ is usually ‘c:\users\username’.
You can create a desktop shortcut to this folder.
The most basic gadget is just two files: a manifest and an HTML page. The manifest is a short snippet of XML, which includes the name of the HTML page; the HTML page is the user interface of the gadget itself.
This is rendered by Internet Explorer 7, so there are few limitations on what you can include, though you need a small page size. One interesting possibility is to host Silverlight, though early adopters have found that some workarounds are needed.
A gadget does have access to the local file system and is similar in many respects to a Windows HTML Application (HTA).
The body of the Countdown gadget looks like this:
<body onload=”init()”>
<g:background id=”background” src=”transparent.png” style=”position:
absolute;
top: 0; left: 0; z-index: -999; no=repeat;” />
<div id=”frame”>
<div id=”countdown”>
123 days</div>
<div id=”towhat”>
until what</div>
</div>
</body>
All Software Applications Tags: Windows-gadgets
