Skip to main content

Past Blast

Featured Products

Windows Mobile Developer Controls
Windows Mobile Developer Controls
Stay in touch using the DEVBUSS RSS feeds.
 

News

Windows Mobile Developer Controls
Sapphire Soltuions

Drop down and drop out.

Written by Carl Davis  [author's bio]  [read 39971 times]
Edited by Derek

Download the code

Page 1  Page 2 

This time I decided to take a break from Windows CE certification to look at something fun I discovered while updating one of my applications. I hope everyone has at least taken a quick peak at the Veritest website to find out how to get certified.

Watch Those Combo Boxes…

You might have noticed that it has been a few months without a report. Well, I've been working hard on a new version of one of my applications (and eating turkey, shopping for Christmas presents, etc…). I ran into a challenge and realized that, once again, I need to improve a old standard user interface to make it easier to use on the PocketPC.

Have you ever seen an application that used combo boxes with too many elements? You may be asking, "What is he getting at?" I mean applications where there are dozens of items that appear in a combo box. For example, have you ever have an application that includes a list of all 50 states? A combo box is literally a drag (or at least a scroll) to use. You need to scroll and scroll to find the right item. How many times have you accidentally tapped "off" the scroll bar only to have the wrong selection and need to start over? Programmers use combo boxes to save some real estate on the screen and they are great for short lists of items. However, we need to make it easier for our users when the list is longer. Who wants to scroll forever to get to the one element you need? You can see an example of what I'm talking about in Figure 1. This shows one of Microsoft's setup programs with a very long combo box containing all the possible locales you can select.


Figure 1

By now, you probably realize that I don't bring up a problem without at least contemplating a solution. In most programs on a desktop a user can jump quickly in a combo box by typing a character. This doesn't work on the Pocket PC but I wanted to provide users a way of "jumping" down a list of selections to minimize the amount of scrolling needed. The PocketPC already has a program that offers the same capabilities: Contacts. A user can quickly jump between sections of their contact list by tapping a command button with a set of three letters. I'll use this as a template to my own replacement for a combo box.

Building the Dialog…

Figure 2 shows the interface for my new control. The screen is fairly simple; it consists of a row of buttons with three letters on each (identical to the contacts application), a done button to accept our choice, and a cancel to ignore our choice.


Figure 2

The application I'm writing is related to role-playing games (what else!) and I need to be able to select from lists items like spells and weapons. These may change over time (as the user's game master creates new ones or new supplements come out) and I could not hard code the items I would add to selection lists. Thus, the control I created uses a text file to define the items the user can select from. An example is shown in Listing 1. The first element on a line is the key, or name, to display in the list. Addition information is stored in a colon-separated list. This is the example I will use to demonstrate this technique. The file is called Students.def.

Able:Chicago:312-555-1222:Loves Cats
Adam:Milwaukee:214-555-1211:Lives at home
Alex:Sleepy Hollow:847-555-3456:Enjoys Snowball fights!
Carl:West Dundee:847-555-1000:Loves computers, super Geek!
Carla:Michigan:None:Carl's Sister.
Chandler:Arizona:555-555-5555:It is hot!
Elizabeth:City:555-555-4000:Couldn't think of anything.
Freddy:North Carolina:454-555-4545:None
George:Test:555-555-5555:None
Jennifer:Test:555-555-5555:None
Jessica:Test:555-555-5555:None
Jimmy:Test:555-555-5555:None
Kathy:Test:555-555-5555:None
Liz:Test:555-555-5555:None
Manuel:Test:555-555-5555:None
Morgan:Test:555-555-5555:None
Nicole:Test:555-555-5555:None
Paul:Test:555-555-5555:None
Roger:Test:555-555-5555:None
Sam:Test:555-555-5555:None
Terry:Test:555-555-5555:None
Tim:Test:555-555-5555:None
Tom:Test:555-555-5555:None
William:Test:555-555-5555:None
Woodberry:Test:555-555-5555:None
X Man:Test:555-555-5555:None
Zack:Test:555-555-5555:None

Listing 1

Next Page