Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

.NET

Developing Windows Vista Sidebar Gadgets


Test and Debug

After creating the Gadget Manifest and referenced HTML file in the .gadget folder (MyFirst.gadget, in this example), you're ready to start debugging. Either copy or move the .gadget folder containing these two files into the c:\Users\YourUsername\AppData\Local\Microsoft\Windows Sidebar\Gadgets path, where "YourUsername" is the name of the active account being used to test the gadget. Opening the GadgetPicker reveals your gadget with a generic icon (Figure 3). This icon appears if there is no <icon> element in the manifest ,or in the case of the MyFirst.gadget example, the image file is missing. If the gadget fails to appear entirely, try opening the gadget.xml file in Internet Explorer. You may discover that your XML has illegal characters or is not well formed. Fix any syntax errors or illegal characters and try again. Once your XML is clean, select the gadget and it will be displayed in the Sidebar (Figure 4). It's that easy.

[Click image to view at full size]

Figure 3: Sidebar GadgetPicker displaying "My First Gadget."

Figure 4: "My First Gadget" running in the Sidebar.

As you enhance the gadget's display with more attractive UI and programmed features, continue to use this GadgetPicker technique to reload any code changes. The Sidebar does not need to be restarted to refresh changes in your gadget's code, but all running instances of your gadget need to be closed before reselecting your gadget from the GadgetPicker to test any code modifications with the new instance.

While an attractive UI makes a good first impression to users, there's only so much interest in an entity with all beauty and no brains. The most popular gadgets will be those that perform a small set of functions extremely well while looking good. There are sure to be gadget programmers who go beyond these expected boundaries by creating full-blown Ajax-enabled wordprocessors and spreadsheets, but doing so is an aberration of the gadget design philosophy. Nevertheless, even with relatively simple programming logic, a script debugger always makes coding and bug hunting more efficient. A JScript debugger (such as those found in Microsoft's Script Debugger and Visual Web Developer 2005 Express Edition or Visual Studio 2005) are adequate (msdn.microsoft.com/vstudio/express/vwd). As is the case with standard web development and JavaScript debugging, be sure to uncheck the "Disable script debugging (Other)" option in Internet Explorer's Tools/Advanced tab.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.