Destination .NET! Platform Tools, Technologies & Resources
1 3 5 7 9
2 4 6 8 10
From VB4, C++ and Java to working on .Net Since Beta, 1.0.
Improving partner satisfaction and accelerating Microsoft platform adoption for managed ISVs.
Is your application compatible with Windows Vista? Make sure today by taking our self-test. Just follow the five steps of the Works with Windows Vista program so that you and your customers can be confident in your solution’s compatibility. Read More >>
What product/topic are you most interested in?
(Choose your top answer.)
Windows Vista
Windows Server 2008
2007 Microsoft Office system
SQL Server 2008
ASP.NET
Visual Studio 2008
Windows Mobile
Software as a Service
A little bit of everything
Just browsing, thanks

View Results
Whether you love the site or hate it, we want to know. Tell us what topics to cover, help us improve things, or just sound off on something we could've done better. Send your feedback directly to the editor by email.
 Print Print
Average Rating: 5/5 | Rate this item | 1 user has rated this item.
Building the DevX Destination.NET Windows® Sidebar Gadget (cont'd)

Architecting the RSS Reader
The DevX team and I decided that for a DevX Destination.NET Gadget, it made the most sense to create a simple RSS reader, but with a slight twist. This one would also employ two filtering options that aligned with the categorization of the site itself. In other words, users would be able to choose the "category" of headline they wanted to see, such as "Live Event" or "Feature", as well as the "subject" of the headline, such as "Windows Vista" or "Microsoft SQL Server" or "2007 Microsoft Office system".

When deciding how to architect the DevX Gadget, I went with a straightforward design. In addition to the required gadget.xml file, I created main.html as the primary Gadget file, with the creatively named flyout.html and settings.html as the single flyout and settings pages, respectively. I put all Gadget styles in a single stylesheet called main.css, but delineated between settings and the other pages when it came to JavaScript, creating dnetgadget.js and dnetgadget_settings.js. I put all of these files in one gadget sub-folder, "EN-US". As noted, except for the Gadget manifest, file naming and placement is entirely up to personal style.

My one nod to organization was to put images in their own "images" folder, which contains no other files. You can use PNG, JPG, and GIF formats in Gadgets, though this one only uses the latter two. Not being adept at graphics in the least, I asked our talented graphics artist, James Kattinge, to design all the assets for this project.

Experienced Web developers will notice that, except for the lack of a traditional index.* or default.* file, so far Gadget development is no different from your typical client-side Web app.

Creating the HTML Pages
As mentioned, this project uses three HTML pages:

  • main.html: the Gadget itself; the object that sits in the Sidebar; this page will read a remote RSS feed and display navigable headlines.
  • flyout.html: the flyout for the Gadget; when a user clicks on a headline, this page will slide out to display the title, article summary, date and author; clicking on the headline in the flyout will bring up the associated URL in the browser.
  • settings.html: the settings page for the Gadget; when the user clicks the Settings button (a little wrench), a Settings template flies out with this page embedded in it; the Settings panel includes an Ok and Cancel button, which produces trappable events.

As you'll see in the Gadget code itself, none of these pages includes complicated HTML code. Their primary purpose is to provide placeholder <div> and <span> tags that can be accessed in the JavaScript code. For example, Figure 1 shows the code from main.html. As you can see, most of this just handles pretty button animation.
Figure 1. main.html

The other two files look even shorter. One important note, however: each HTML file includes an onload() function in the <body> tag:

 main.html: onload="setup();"
flyout.html: onload="buildFlyout();"
settings.html: onload="buildSettings();"

Page 3 of 7
Previous Page: Architectural Overview continued Next Page: Special Considerations for CSS
Page 1: Architectural OverviewPage 5: JavaScript Walkthrough #1: Gadget
Page 2: Architectural Overview continuedPage 6: JavaScript Walkthrough #2: Setting
Page 3: Architecting the RSS ReaderPage 7: Deployment, Wrap-up, Lessons Learned
Page 4: Special Considerations for CSS 
Submit article to:
Extending your solution to run on Microsoft technology is easier than ever. Through NXT, you can reach more customers, increase revenues and slash development time and costs, accelerating both your time to market and profitability. Get the details on NTX. >>
Sign up for your free e-mail newsletters today!
DevX Windows Developer Update

More Newsletters
.NET Building Blocks: Custom User Control Fundamentals
Quickly Copy Data Rows from DataReader to a DataTable
Introduction to the WPF Command Framework
Taming Trees: Building Branching Structures
Implement Drag and Drop in Your Windows Forms Applications



JupiterOnlineMedia

internet.com earthweb.com Devx.com mediabistro.com Graphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Copyright 2008 Jupitermedia Corporation All Rights Reserved.
Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers