touch screen
CodeGuru: Touchscreen Support in Qualcomm Brew
#navitoolbarcontainer a {
line-height: 16px;
}
IT
internet.com/IT
internet.com/CIO
internet.com/Security
internet.com/Networking
internet.com/Storage
bITa Planet
CIO Update
Database Journal
Datamation
Enterprise IT Planet
Enterprise Networking Planet
Enterprise Storage Forum
eSecurity Planet
Hardware Central
Intranet Journal
ISP Planet
ITSMwatch
IT Channel Planet
Linux Planet
Open Networks Today
ServerWatch
VoIP Planet
WebVideoUniverse
Wi-Fi Planet
WinDrivers.com
Network Map
Developer
internet.com/Developer
15 Seconds
4GuysFromRolla.com
ASP101
CodeGuru
Developer.com
DevX
FlashKit.com
Gamelan
JARS
JavaScript.com
JavaScriptSource
PHPBuilder.com
ScriptSearch
VB Forums
VB Wire
WebDeveloper.com
Webreference
Network Map
News
Internetnews.com
Linux Today
Network Map
Small Business
Ecommerce Guide
Refer-It
SmallBusinessComputing
Webopedia
WinPlanet
Network Map
Personal Tech
BlackBerryToday
iPhoneGuide
Jumbo
Megapixel.net
Palm Boulevard
PDAStreet
PocketPCWire
SharkyExtreme
Smart Phone Today
The List: ASPs
The List: Broadband
The List: ISPs
The List: WebHosts
The List: WebDesigners
Wi-FiHotSpotList
WindowsMobileToday
Network Map
Events
JupiterEvents
internet.com/webcasts
Jobs
Partners
Solutions
eBooks
Video
Shop
Login
Manage My Profile
Register
Why Join?
IT MANAGEMENT
CIO Update
Datamation
eCRMGuide
DRM Watch
eSecurity Planet
ITSMWatch
Intranet Journal
Inside ID
Grid Computing Planet
bITa Planet
IT Career Planet Planet
NETWORKING
EnterpriseNetworkingPlanet
InstantMessagingPlanet
EnterpriseStorageForum
OpenNetworksToday
OpticallyNetworked
PracticallyNetworked
WEB DEVELOPMENT
HTML Goodies
Javascripts.com
HARDWARE & SYSTEMS
EarthWeb Hardware
SysOpt
Virtual Dr.
WorkstationPlanet
SOFTWARE DEVELOPMENT
CodeGuru
Developer
jGuru.com
JARS
Gamelan
EARTHWEBNEWS.COM
Business
Developer
Ecommerce
Enterprise
Networking
Security
Special Reports
Storage
Commentary
Wireless
xSP
Stats
IT MANAGEMENT
NETWORKING
WEB DEVELOPMENT
HARDWARE & SYSTEMS
SOFTWARE DEVELOPMENT
IT NEWS
CodeGuru.com
---Articles
---Comments
---Forums
Earthweb
Visual C++ / C++
Visual C++ / C++
C++ »
C++ »
Algorithms & Formulas
C++ & MFC
Date & Time
Managed C++
String Programming
COM-based Technologies »
COM-based Technologies »
ATL & WTL Programming
ActiveX Programming
COM+
Shell Programming
Controls »
Controls »
Button Control
ComboBox
Edit Control
ImageList Control
ListBox Control
ListView Control
Menu
Other Controls
Property Sheet
Rich Edit Control
Static Control
Status Bar
Toolbar
Treeview Control
Data »
Data »
Database
Miscellaneous
Frameworks »
Frameworks »
UI & Printing Frameworks
Graphics & Multimedia »
Graphics & Multimedia »
Bitmaps & Palettes
DirectX
GDI
Multimedia
OpenGL
Internet & Networking »
Internet & Networking »
IE Programming
ISAPI
Internet Protocols
Network Protocols
Miscellaneous »
Miscellaneous »
Miscellaneous
Samples
Security
Security
Standard Template Library
Standard Template Library
Visual Studio »
Visual Studio »
Add-ins & Macros
Debugging
Editor Tips
Windows & Dialogs »
Windows & Dialogs »
Console
Dialog
Doc/View
Docking Window
Splitter
Windows Programming »
Windows Programming »
CE
Clipboard
DLL
File & Folder
Help Systems
Printing
System
Vista
Win32
Sample Chapter
Sample Chapter
.NET / C#
.NET / C#
.NET »
.NET »
Data & Databases
Debugging
Framework
General
General ASP.NET
JScript .NET
Managed C++
Net Security
VS Add-Ins
Silverlight
WCF
WPF
Windows Workflow
C# »
C# »
Basic Syntax
Collections
Controls
Data & I/O
Date & Time
Delegates
Graphics & Multimedia
Internet
Miscellaneous
.NET 3.0 / .NET 3.5
Network & Systems
Web Services
LINQ
Sample Chapter
Sample Chapter
Visual Basic
Visual Basic
General »
General »
Database
Forms & Controls
IDE & Language
Misc
System
VB Graphics
VB Multimedia
Internet »
Internet »
ASP .NET
Database
HTML
Indexing
SMTP / eMail
Web Services
Mobile/Wireless »
Mobile/Wireless »
Mobile InternetToolkit
Pocket PC
.NET 3.0
LINQ
.NET 3.0
VB Controls »
VB Controls »
.NET Controls
VB ActiveX
VB ComboBox
VB Files
VB ListBox
VB ListView
VB Other Controls
VB Shell
Sample Chapter
Sample Chapter
Videos
Submit an Article
Discussion Forums
Resource Directory
Announcements
Book List
Book Reviews
List of Gurus
Guest Book
Technology Jobs
About Us
FAQs
Site Map
User ID:
Password:
Remember Me:
Forgot Password?
Not a member?Click here for more information and to register.
/*
-----------------------------------------------
Partner Styles
----------------------------------------------- */
#skypartnerset {
width: 160px;
clear: both;
color: #333;
font-size: 10px;
background-color: #fff;
border: 1px solid #333;
margin-bottom: 10px;
font-family: arial, verdana, helvetica;
}
#skypartnerset a, #skypartnerset a:link, #skypartnerset a:visited {
width: 160px;
clear: both;
color: #333;
font-size: 10px;
margin-top: 10px;
}
#skypartnerset a:hover {
text-decoration: none;
}
#skypartnerset p {
padding-bottom: 2px;
border-bottom: 1px solid #ccc;
}
Become a Marketplace Partner
Build mobile apps, win Ђ15,000 & a trip to Spain
Search
internet.commerce
Partners & Affiliates
Shop Online
Find Software
Car Donations
Shop
Corporate Gifts
Compare Prices
Rackmount LCD Monitor
Home Improvement
Memory
Web Hosting Directory
Best Price
Laptop Batteries
Desktop Computers
Computer Hardware
RSS Feeds
All
VC++/C++
.NET/C#
VB
See more EarthWeb Network feeds
Home >> Visual C++ / C++ >> Windows Programming >> CE >> Controls
Best Practices for Developing a Web Site: Checklists, Tips, Strategies & More. Download Exclusive eBook Now.
Touchscreen Support in Qualcomm Brew
Rating: none
Ray Rischpater (view profile)
April 10, 2008
Although the Apple iPhone was not the first touchscreen cell phone on the market (think back to Windows Mobile and Treo devices), it's certainly caused quite a fuss for carriers and manufacturers, all of whom have been in quite a rush to launch their own touchscreen devices. Many of these devices run Qualcomm Brew, and it's perhaps not surprising that Brew has had support for touchscreens for a long time—since BREW 2.x, in fact. In this article, I show you how to receive touchscreen events so you can add touchscreen support to your own applications. Everything I describe works in the simulator, so you can do your development normally, test in the simulator, and as you receive hardware for testing, be ready to deploy your application.
The IControl Interface and Touchscreen Events
(continued)
Heroes Happen Here
New products, new technologies: Microsoft SQL Server 2008, Microsoft Visual Studio 2008, and Windows Server 2008 create new opportunities to use your existing skills and to grow your business.
»
Tips for Growing Your Microsoft Practice
You can grow your practice by increasing business with existing clients or adding more customers, expanding your practice areas or expanding your business into hosted or managed services. Discover which approach to growing your business makes the most sense for you and your customers.
»
Drive Your Business with Microsoft
Explore the business opportunities available through the Microsoft Partner Program, which is designed to help you generate leads, drive customer demand and sales, increase your profitability, and assess your business performance.
»
Partner-to-Partner Networking: A New Paradigm in Relationship Building
Heres a great way to build your business: Team up with partners whose solutions and services work as an extension of your own offerings. View this Webcast to learn how building networks with other partners can help your business grow.
»
IT Provider Grows Profits 85% in One Year with Microsoft Technologies
Knight Enterprises Inc., a longtime Novell partner, chose to add Microsoft technologies to its offerings after attending a Microsoft partner event. The company's major accounts soon followed suit, opting for Microsoft solutions over those of the competition. Download this case study to discover how Knight now expects its revenue to double in two years time.
»
The good news is that if you're one of the relatively few developers who are happy using Brew's IControl interface hierarchy, you get touchscreen support essentially for free. Text controls and menus accept touch input, so all you need to do is handle control selection by touch.
To make sure your IControl-based application is ready for touch support, you need to do two things:
Ensure your application passes touch events to the controls.
Be sure that when the user touches outside a control and on another control that you transfer focus to the touched control.
The first is relatively easy: Just be sure you pass all events to the underlying active control using ICONTROL_HandleEvent. Generally, it's best to do this at the beginning of your event handler, like this:
static boolean HandleEvent( CApp *pMe, AEEEvent ec, uint16 w,
uint32 dw ) { boolean result = FALSE;
if ( pMe->pIActiveCtl ) {
result = ICONTROL_HandleEvent( pMe->pIActiveCtl, ec, w, dw );
}
if ( !result ) switch( ec ) {
// Handle event cases here.
}
return result;
}
The second is easy, too, as long as you can do hit testing to determine where the user touched the screen. Once you do this—the subject of the next section—you should defocus the current control and give focus to the new control, doing something like this:
if ( pMe->pIActiveCtl ) {
ICONTROL_SetActive( pMe->pIActiveCtl, FALSE );
}
ICONTROL_SetActive( pINewFocusedCtl, TRUE );
pMe->pIActiveCtl = pINewFocusedCtl;
Accepting touchscreen Events
Under the hood, BREW defines the following events for touchscreens:
EVT_PEN_DOWN when the user touches the display
EVT_PEN_MOVE while the user moves along the display while touching the display
EVT_PEN_UP when the user stops touching the display
EVT_PEN_STALE_MOVE if the user has moved along the display while touching the display and there are newer EVT_PEN_MOVE events in the queue
Thus, the general sequence of events when the user touches the display is one of EVT_PEN_DOWN, EVT_PEN_UP (for quick taps) or EVT_PEN_DOWN, a series of EVT_PEN_MOVE (perhaps with one or more EVT_PEN_STALE_MOVE events). The coordinates (x and y) of the event are delivered to you as a set of packed integers in the uint32 that accompanies the event; you can get just the x- or y-coordinate from the packed integer using the BREW helper functions AEE_GET_X and AEE_GET_Y.
Consequently, hit-testing—detecting which item is touched—in your event handler is easy, especially if you keep a list of objects that can be touched by the user. This is especially important if your application is a game or another application that doesn't use the BREW IControl hierarchy of controls. The basic algorithm is:
// On EVT_PEN_UP
int x0 = AEE_GET_X( dw );
int y0 = AEE_GET_Y( dw );
while( there are more objects in the list ) {
int x = current object in list's x coordinate
int y = current object in list's y coordinate
int dx = current object in list's width
int dy = current object in list's height
if ( x0 > x && x0 < x + dx && y0 > y && y0 < y + dy ) {
// the current object is one hit by the touch event
// focus it, activate it, or what have you.
}
You want to do the hit testing on the EVT_PEN_UP event, not the EVT_PEN_DOWN event, because it gives the user a chance to cancel a selection by touching something, moving away from the item they touched while still touching the screen, and then releasing the screen. This is analogous to how buttons work in a desktop user interface: Try clicking down on the OK button of a dialog and then dragging the mouse away from the button; when you release the mouse, the OK action is only taken if the pointer is over the screen.
Handling EVT_PEN_MOVE is a different story; if you want to implement dragging, you must be prepared to do whatever additional work on each EVT_PEN_MOVE event that's required. Whatever work your application performs here should take as little time as possible because your application can receive a lot of EVT_PEN_MOVE events.
A Bit of Advice...
When implementing touch support, you should remember that touch positions are approximate. This doesn't so much reflect inaccuracies in the hardware as it reflects the inability of a user to precisely position their fingertip or a pen tip on exactly one spot of the screen. The user may be in motion (walking, riding a bus, or heaven forbid, driving), and both pointer and device will be in lateral motion, effectively adding noise to the input your application is trying to obtain.
To work with this, make your hit areas large. Some carriers may mandate hit area size on some phones, especially given the small dot pitch of today's screens. It's nearly impossible to hit a 16x16 rectangle when that's only two-tenths of an inch on a side! Controls should be properly sized—a line of text may not be tall enough to be a single control, so consider using the extra screen real estate these devices have to provide big fat touchable areas for your users. Some carriers may mandate a minimum hit size (probably around forty pixels on a side, but you should check with your carrier partners!) for specific devices, and you may fail carrier certification if you don't meet those requirements. This is especially true for devices directly competing with the iPhone, where users are expected to use their finger, not a stylus, to touch the display.
Conclusion
Adding touch support to your application isn't hard, especially if you're already leveraging Brew's IControl hierarchy of interfaces. Just be sure to send the pen events to the active control, and add hit testing to your application to determine which control should be activated. If you've created your own controls, it's a little more work: Be prepared to handle the trio of EVT_PEN_DOWN, EVT_PEN_MOVE, and EVT_PEN_UP events; most of your work is likely in handling EVT_PEN_UP, because that's what confirms what your user wants to do. Regardless, it's not difficult to be ready for the wave of touchscreen phones coming to market!
About the Author
Ray Rischpater is the chief architect at Rocket Mobile, Inc., specializing in the design and development of messaging and information access applications for today's wireless devices. Ray Rischpater is the author of several books on software Development including eBay Application Development and Software Development for the QUALCOMM BREW Platform, both available from Apress, and is an active Amateur Radio operator. Contact Ray at kf6gpe@lothlorien.com.
Tools:
Add www.codeguru.com to your favorites
Add www.codeguru.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed
Learn about expanding business opportunities for the reseller channel. Visit IT Channel Planet.
Five Trends for Application Development. Download Your Complimentary Report. Exclusive. Act Now.
Elementool PDF: Bug Tracking Saves Hundreds of Hours a Month in Software Development Time
Data Sheet: IBM Information Server Blade
Best Practices for Developing a Web Site. Checklists, Tips & Strategies. Download Exclusive eBook Now.
RATE THIS ARTICLE:
Excellent Very Good Average Below Average Poor
(You must be signed in to rank an article. Not a member? Click here to register)
Latest Comments:
No Comments Posted.
Add a Comment:
Title:
Comment:
Pre-Formatted:
Check this if you want the text to display with the formatting as typed (good for source code)
(You must be signed in to comment on an article. Not a member? Click here to register)
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.
Advertise | Newsletters
| Tech
Jobs | Shopping | E-mail
Offers
Solutions
Whitepapers and eBooks
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
Avaya Article: How to Begin Developing with Avaya's Event Processing Language
HP eBook: Storage Networking , Part 1
ServerWatch.com Article: Tip of the Trade--IP Address Management
ITChannelPlanet.com Article: Enterprise Fixed-Mobile Convergence Can Be Lucrative
Hoover's Whitepaper Series: A Guide to Marketing in the Age of Social Media
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
Internet.com eBook: All About Botnets
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
HP Video: Page Cost Calculator
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Partner Program Video: The Secrets to Partner Success
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
How-to-Article: How to Market Your Technology Solutions
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
разделы
гильза цилиндр
защитный краска
сдача ielts
юр.адрес
snr roulements
флажок настольный
фосфорный краска
пп-пленка
фосфорицирующая краска
красный площадь собор
холодный обзвон
пежо 407
нард скачать
арочный конструкция
органический растворитель
измеритель rlc
qtek
лекарство рак
облицовка bella italia
футбольный тотализатор
газонокосилка stiga
бензопила dolmar
витрина мороженый
дермато-венеролог
центральный детский мир
автоматический резка
видеосъемка торжество
дмитрий шумок
холодильник норд
видеосъемка
флеш презентация
ваза 2114
электропечь dimplex model lee rc
альтернативный медицина
валерий билет
домашний очаг здоровье
фосфорицирующая краска
intex
touch screen
isdn видеоконференция
измеритель петля фаза нуль
банковский ячейка
маска косметический
применение доломита
кофе колониальный товар
ubiquam
герб область
сборщик долг
анкетирование
зеркало вагинальный
пакет гриппер
li-da
экстракт корень лопух сух.
купить угольник перех
три цвета: красный
крановый тележка
vps vds
растворитель
купить стиральный
курьерский почта
ковры резиновый
продажа кофе
shell
фирменый цвет
перегородка сантехкабин
omega
спецобувь
купить блендер
ведро шампанский
стеклянный перегородка
выборочный лак
ваза 2112
сервис alfa laval
лечение зарубежом
красный площадь мавзолей
купить автотехнику
крутой компания
бахила
электрокамин dimplex model silver (sp4)
дюпон краска
зона ограничение доступ
доставка хим. реагент
заказ обед
отбеливание
купить пароварка
кухонный техник
волосовский доломит
курьерский почта
горячий обед
деловой костюм
вытяжка
эфирный антенна kaasi
теннисный ракетка
напыление ппу
купить букмекерский линия
кулер 775
купить nokia 8910
лучший ковры
dvd-box
зеркало багуа
бестраншейный облицовка
теннисный ракетка
доломит
touch screen