Nick's .NET Travels

Continually looking for the yellow brick road so I can catch me a wizard....

What works/What doesn’t in Windows Mobile 6.5 Widgets

This is going to be the question that is often raised when developers start building widgets for the Windows Mobile 6.5.  Whilst this MSDN article covers some of the basics, it doesn’t cover which common frameworks are supported.  For example is jquery supported? The answer is kindof.  If you go to the jquery test page in IE Mobile on a Windows Mobile 6.5 device (which is the same engine widgets use) you won’t even see the test items appear.  However a lot of the functionality seems to work when you use it in a widget.

Now one thing you can do is to look at which version of javascript (take a look at the wikipedia article on support for ECMAScript in various layout engines) is supported but I suspect that is going to be fairly meaningless unless you know what you’re looking for.  An alternative is to just to try stuff and work out what will/won’t work.  Again this is not a great approach as it means a lot of wasted cycles. 

Luckily the guys at Microsoft have already spent cycles building showcase widgets. There is one included in the emulators as part of the Windows Mobile 6.5 Developer Tool Kit, which is the Search Widget.

image

If you connect the emulator though either ActiveSync or the Windows Mobile Device Center you can take a look at the contents of this widget by going to “\Program Files\Widgets\User\1” using File Explorer. In fact if you want to get your head around how it all works, simply copy this entire folder across to your desktop and open that folder using File –> Open –> Web Site… in Visual Studio 2008.  If you are going to step through the code you may want to run the various javascript files (in the js folder) through a beautifier (http://jsbeautifier.org/) to that it’s easier to follow.

There are a number of javascript files, namely widget.js, utils.js and menu.js, that show you can wrap the built in widget functionality to make it more accessible and easier to use. It’s also worth taking a look at the way this widget is structured as it is setup using language specific folders so that it can handle different languages on the device.

Note: The Search Widget found on the emulator is not sample or redistributable code. I’m recommending that you only use it to understand how widgets work and what will/will not work.

Comments are closed