Developer .NET UPDATE, January 16, 2004
When you develop Windows .NET Compact Framework applications, you can encounter limitations that relate to the available display area for controls on your form. Here are some tips and tricks you can use when working with TextBox controls.
January 20, 2004
Developer .NET UPDATE—brought to you by SQL Server Magazine
http://sqlmag.com
This Issue Sponsored By
DEVCONNECTIONS: WIN A HARLEY MOTORCYCLE
http://www.devconnections.com
January 16, 2004--In this issue:
1. Developer .NET Perspectives
More Compact Framework Tips and Tricks
2. Announcements
5 Years Worth of SQL Server Content in One Place
Need to Get Your Hands Wrapped Around SQL Server?
3. Resource
Featured Thread: Windows .NET Architecture to Port to Mac OS X
4. Event
New Web Seminar: Email Is a Service--Manage It Like One
5. New and Improved
Create Web-Based Surveys and Forms
6. Contact Us
See this section for a list of ways to contact us.
1. Developer .NET Perspectives
by Marquis Howard, [email protected]
More Compact Framework Tips and Tricks
In the column "Compact Framework Tips and Tricks" (http://www.winnetmag.com/windows/article/articleid/41243/41243.html), I told you about certain UI limitations you encounter when designing Windows .NET Compact Framework applications. The primary UI limitation relates to the available display area for controls on your form. In "Compact Framework Tips and Tricks," I showed you how to work around problems associated with using the DataGrid. In this column, I show you how to work around problems associated with the TextBox control.
If your form for a Compact Framework application requires no input from the user and basically displays data by way of a Label control, DataGrid, Combo Box control, or most any control besides a TextBox control, your main concern will be the layout of the controls. Are the controls positioned on the form in a way that makes sense? If the application has multiple forms, is the navigation consistent throughout the entire application? All these elements will measure the application's usability.
If you need to use TextBox controls to gather input from users, you might encounter a problem that's easily overlooked. When working with a Compact Framework application, you must take into consideration the relationship between the location of the text box and how data is entered. Data entry on most handheld devices isn't typed but rather tapped in. Users use a stylus to tap a soft input panel (SIP). A SIP is basically a small onscreen keyboard that contains the same characters as a regular keyboard. When users need to enter data, they open the SIP and the SIP appears at the bottom of the screen.
The SIP takes up about a third of the bottom of the screen. This detail is important to remember when you're laying out your TextBox controls. If you place a TextBox control toward the bottom of the screen, it might be partially or fully hidden by the SIP when it appears.
To paint a mental picture, let's say your form needs to have eight TextBox controls with eight accompanying Label controls, with one TextBox control and one Label control per row. Using the default sizes of each control, you can place five rows of TextBox controls on a form before the SIP would hide the last three rows of TextBox controls.
You could place five text boxes on one form and the other three text boxes on an additional form, which would force the user to go to another screen to finish entering data. Some customers might find this approach reasonable. Other customers, however, might find this approach unacceptable.
In the latter case, one solution is to use a mechanism that prompts the form to scroll. That way, you can add as many rows of TextBox controls as needed yet always have each text box positioned above the SIP. But what if a customer doesn't want any scrolling? Don't fret--here's a solution that has worked quite well for me. From the Toolbox inside of Visual Studio .NET, place a Panel control on your form. This unseen but useful control lets you group controls together. By grouping controls into a panel, applications can hide or display the group of controls with one command.
After you have your panel on the form, size it so that you have enough room to place the last three rows of TextBox and Label controls inside the panel's borders. Next, position the panel and its controls at the bottom portion of your form. The desired effect is to make the last three rows seem as though they're part of the form, so make sure that the three TextBox and Label controls line up with the other five TextBox and Label controls.
The final step is to write a method that will shift the panel to a position above the SIP when the users initially tap one of the text boxes in the panel. This way, your user can see the text they're entering without having to switch to another form in the application. Here's a sample method that illustrates this technique: private void TextBox_GotFocus(object sender, System.EventArgs e) {
// See whether the SIP is currently visible.
if (this.SIPcontrol == null || !this.SIPcontrol.Enabled)
{
this.SIPcontrol.Enabled = true;
}
// Move the panel so that the text boxes are visible.
this.panelTextBoxes.Top = 48;
}
Sponsor: DEVCONNECTIONS: WIN A HARLEY MOTORCYCLE
Dev Connections conference and expo will be held April 18 - 21. Back by popular demand are concurrently running events Microsoft ASP.NET Connections, Visual Studio Connections, and SQL Server Magazine Connections. Details about workshops, sessions, and speakers are online, including the exclusive Microsoft Day on "Yukon" and "Whidbey". Save $200, receive access to all three conferences for one price, and get a chance to win a Harley motorcycle. Go online or call 800-438-6720 or 203-268-3204.
http://www.devconnections.com
2. Announcements
(brought to you by SQL Server Magazine)
5 Years Worth of SQL Server Content in One Place
Subscribe to the SQL Server Magazine Master CD and get real-time, portable access to all articles, code, tips, tricks, and expertise published in SQL Server Magazine and T-SQL Solutions. Search by keyword, subject, author, or issue and find fast answers to your SQL Server questions. Subscribe today!
https://secure.pentontech.com/nt/sql/index.cfm?promocode=scep2841md
Need to Get Your Hands Wrapped Around SQL Server?
Subscribe to SQL Server Magazine and get all the newest information and tools needed for SQL Server. You'll receive 12 print issues, along with full access to the entire online article archive. Bonus--you'll also get the latest Microsoft System Table Map Poster. Subscribe today!
https://secure.pentontech.com/nt/sql/index.cfm?promocode=psep2141fd
3. Resource
Featured Thread: Windows .NET Architecture to Port to Mac OS X
Novice forum member Paulspal reports that the Windows .NET architecture will soon be ported to Mac OS X, according to representatives at the MacWorld Conference & Expo last week. If you want to comment on this development, go to the following URL:
http://www.winnetmag.com/forums/rd.cfm?cid=55&tid=66680
4. Event
(brought to you by SQL Server Magazine)
New Web Seminar: Email Is a Service--Manage It Like One
True end-to-end management of the messaging infrastructure requires an integrated, service-oriented approach. This free Web seminar introduces service-driven management and best practices for managing and monitoring the key elements crucial to ensuring email health and performance, including Exchange Server, Active Directory, network, and storage. Sign up today!
http://www.winnetmag.com/seminars/emailservice/index.cfm?code=adzt
5. New and Improved
by Shauna Rumbaugh, [email protected]
Create Web-Based Surveys and Forms
Quask released FormArtist 3.0, desktop software that lets Web developers, customer relationship management (CRM) professionals, and other professionals create and publish Web- and email-based surveys, forms, e-brochures, and opinion polls. The product has a WYSIWYG interface, style sheets, and a library of data-collection objects and form-design features for creating forms easily and quickly without the need for programming. To further customize surveys and forms, developers can use the dialog-driven script manager or write JavaScript directly to interact with the form. FormArtist Presto is the most basic edition, and FormArtist Standard adds a database and lets users export data to charts and tables. FormArtist Professional and FormArtist Enterprise integrate with third-party CRM software. The enterprise edition includes advanced server-side Microsoft .NET and Microsoft SQL Server components. See the vendor's Web site for pricing information or to download a free trial version.
http://www.quask.com
Sponsored Links
Argent
Comparison Paper: The Argent Guardian Easily Beats Out MOM
http://ad.doubleclick.net/clk;6480843;8214395;q?http://www.argent.com/products/download_whitepaper.cgi?product=mom&&Source=WNTTextLink
VMware Inc.
Are you an MCSE/MCP? Let VMware Workstation put $100 in your pocket.
http://ad.doubleclick.net/clk;6966714;8214395;w?http://www.vmware.com/wl/offer/497/0
6. Contact Us
About Developer .NET Perspectives -- [email protected]
About the newsletter -- [email protected]
About technical questions -- http://www.sqlmag.com/forums
About product news -- [email protected]
About your subscription -- [email protected]
About sponsoring an UPDATE -- contact Kate Silvertooth ([email protected])
This email newsletter is brought to you by Windows & .NET Magazine,the leading publication for IT professionals deploying Windows andrelated technologies. Subscribe today.
http://www.winnetmag.com/sub.cfm?code=wswi201x1z
View the Windows & .NET Magazine Privacy policy at
http://www.winnetmag.com/aboutus/index.cfm?action=privacy
Windows & .NET Magazine a division of Penton Media, Inc.
221 East 29th Street, Loveland, CO 80538
Attention: Customer Service Department
Copyright 2004, Penton Media, Inc. All Rights Reserved.
About the Author
You May Also Like