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)

Special Considerations for CSS
Gadgets use pretty standard stylesheets, with one caveat. You absolutely must define height and width of the gadget body, either in the CSS or your gadget HTML (or in the JavaScript code). Gadgets don't come with default dimensions, so you may end up with something tiny and unusable in your sidebar if you don't define them.

For this gadget I used <div> and <span> elements with both absolute and relative positions, rather than tables. I defined dimensions, as well as placement, for most of the elements, and used the "background" property to set images. (So if you're trying to figure out where those graphics come into play, check main.css.)

As an example, here is the portion of main.css pertaining to main.html elements:

 #gadgetbody {
	position:absolute;
	top:0px;
	left:0px;
	height:200px;
	width:130px;
	background: url(../images/gadgetbackground.jpg) no-repeat;
}

#dnetlogo {
	position:relative;
	height:25px;
	width:130px;
	cursor:hand;	
}

#headline {
	position:relative;
	top:25px;
	left:10px;
	height:85px;
	width:110px;
	margin:0px 0px 0px;
	font-size:10px;
	font-family:Calibri;
	border: none;
	cursor:hand;
	overflow:ellipsis;
}

#headlinenav {
	position:relative;
	left:10px;
	top:5px;
	width:110px;
	height:50px;
	font-size:12px;
	font-family:Calibri;
}

Another side note: the settings page is a strange little beast. The Sidebar API provides a standard panel with an Ok and Cancel button. Any settings page you specify sits within this panel. Take a look at Microsoft's pre-built Gadgets and you'll see that they took great pains to position assets in the center of the Settings panel using good ol' tables and spacer GIFs. If you want a cleanly branded Settings panel that looks like it belongs to the Gadget, this seems to be your only option since your stylesheets will only apply to the settings HTML page, not the panel itself.

Page 4 of 7
Previous Page: Architecting the RSS Reader Next Page: JavaScript Walkthrough #1: Gadget
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