MEDC

Fri, April 8, 2005, 02:22 PM under Events
Mobile & Embedded Developer Conference

I'll be there! Come say hello at the Microsoft booth or at the "Ask The Experts" session.

Register Today

Early Bird Registration ends April 20

Honeywell

Mon, April 4, 2005, 02:02 PM under Personal
Honeywell acquired Novar.

This means that while previously my company was part of the Intelligent Building Systems division (of Novar), now we are part of Automation and Control Solutions (of Honeywell).

Notice that we were, and still are, Trend.

To any Honeywell employees out there reading my blog: "Hello colleague :-)"

Blog link of the week 13

Sun, April 3, 2005, 03:33 PM under Links
I've been considering this lately, so the advice in this article is very welcome.

:-D Reserved for whom?

Revelations

Thu, March 31, 2005, 03:07 PM under Random
I have it from a good source that Whidbey will ship in May. I was as surprised as you are when I found out and a part of me thinks they meant 2006, but the context of the conversation was 2005, so make of it what you will.

Expect more inside MSFT information now that they offered me a job. I wouldn't accept it but, since my company is being taken over by some other company, I thought it was a good time to move. It is not on the CF team as you'd expect, though. Instead the C# team has hired me with my first task being implementing a background compiler for the Orcas release. Stay tuned.

On the Compact Framework front, you will have heard by now that sanity has prevailed and CF 2.0 will be supported on WinCE 4.2 (woohoo)

Finally, a blog entry without a link is not a blog entry so, as well as posting this over at my "meme" blog, see below who you are messing with:


What Famous Leader Are You?
personality tests by similarminds.com


Oh, I almost forgot: the MSDN Universal price tag will increase by £500 but it will include Visual Studio Team System Suite!

February CTP

Thu, March 31, 2005, 12:06 AM under Whidbey | VisualStudio
We know the February CTP contains older device bits than the November CTP, but since the DVD arrived through my letter box I thought I'd install it (yes I have better things to do but I was curious alright :-)

My goal was to find 5 things I didn't know about (not necessarily new in this CTP) *and* they should not be CF-specific.

1. PropertyGrid control. I hadn't noticed that this is now part of the default toolbox for winforms. BTW, if you want to use it today with VS2003, see this.

2. Object Test Bench for VB :-) They told me they would not do it. If you've got the Feb CTP, go play with it (e.g. follow the C# steps described here).

3. This has been true since Whidbey went public, but I only just noticed it. If in a C# project (or with VS not having any project loaded), you open a VB file, its regions are recognised :-) [This always pi**es me off with VS2003]. A related nice option is "Tools-Options-Text Editor-File Extension"

4. You know about partial classes. Well, VB still doesn't show us the constructor in the file we edit by default (like C# does) :-(

5. Select the menu "Class Diagram-Display Types". I guess this is a tiny step closer to having method signatures but until that happens... Anyway, there are other reasons to moan about once you observe how this is implemented in C# as opposed to VB. The way I see it, this is another blow for VB developers.
"You cannot cope with UML notation for return types, which is simply replacing 'As' with ':' *but* C# developers are perfectly capable even though the change is larger (moving the return type from the front of the method name to the back and precede it with a colon)."
As a UML shop through and through, this is yet another reason for us not to use the Class Designer (or to ditch VB for any new projects).

Thread.IsBackgroundOrIsIt()

Wed, March 30, 2005, 01:46 PM under MobileAndEmbedded
One of the missing methods from NETCF 1.0 today is Thread.IsBackground.

CF 2.0 will support this method with a few noteworthy caveats. Read carefully Brian Smith's contributions in this thread.

Blog link of the week 12

Sun, March 27, 2005, 02:53 PM under Links
* In protest to the pricing model of Team System, no msft blog will be linked from this week's BLOTW. The pricing model is widely discussed in the blogosphere, but I find the quote at the end of this entry covers my thoughts:
"Congratulations to the development teams bringing these products to us. We're glad that you've been listening. Now go kick down the doors of the marketing people and blast them for wasting your time."

* On Monday, Roger asked in the wince.app.dev ng if people would be interested in styled controls; I directed him to the cf ng, where he got positive feedback. Here is the result.

* Seems I have to brush up on my UML, as there is a diagram in v2.0 I was not aware of

* In the past I run an internal "Advanced .NET Basics" session (covering the topics on this list). This full day tutorial seems to cover similar ground and all material is available for download.

* Don't throw from finally

SmartPhone development quick start

Sat, March 26, 2005, 10:25 AM under MobileAndEmbedded
So you have experience developing .NET Compact Framework applications targeting your Pocket PC (2000/2002 or WM2003) or even custom Windows CE devices. Now you want to dabble with SmartPhone 2003 development, since CF supports that too (but not SP2002). Where do you start?

The first thing to do is install the SmartPhone SDK. This will give you a new Smart Device Project type and an emulator of course (you may also get the Second Edition Emulator. Usually you choose the Pocket PC platform, now you should choose Smartphone (the only omission from the "project type" list is the "Non-graphical Application", a.k.a. "Console Application" on the Windows CE platform).

So the new project is created. The first thing you note is that the form is small (182w x 239h). In reality, the area you can manipulate is 176x180 pixels since you'll have a border, title bar and menu area. The menu area is actually the space for two soft keys (more on those in a moment). The second limitation we observe is the toolbox; device controls are already much fewer than the desktop, but they are further halved in numbers for Smartphone projects [VS2003 toolbox][VS2005 toolbox]. Later, I'll say a couple of words for some of the 14 controls (datagrid doesn't work) we have at our disposal.

At this point, it is worth stating the obvious: the SP has no touch screen and all interaction is via hardware buttons. The emulator [vs2003][whidbey] gives us some clues. Let's have a closer look at the buttons moving from the top downwards:

There are 3 sections:
1. LCD area
-Two button directly below the screen (a.k.a. soft keys).

2. Middle/center of the phone
-Two phone keys. Green for call and red for hungup.
-Below the call button there is a "home" button.
-Below the hungup button is a "Back" button.
-Between the 4 buttons just described is the rocker [Left, Right, Top, Down and Enter/Action]

3. Lower end of the phone
-Typical 12-button keypad found on all phones

In theory you could hook into any of these buttons and do whatever you want, but it makes sense to remember that the device's primary use is as a phone and also that MSFT has some guidelines for SP applications (some of which are enforced by the CF at runtime). For example the 12-button keypad can be used only for data entry (e.g. on a textbox); the call/hungup buttons (with the green & red phone icons) should be left alone, as should the home button (house icon). The back button navigates to the previous form (or to the previous application, if you are on the main form).

So let's look at the remainder buttons in correlation to the CF controls.

+ The following controls have no user interaction (other than displaying info, of course):
Label, Panel, PictureBox, ProgressBar, Timer, ImageList, VScrollBar, HScrollBar

+ The following 3 controls should be the only control on a single line (other than non-interactive controls mentioned above, of course):

- CheckBox
Up/Down move to the previous/next control on the form. Left/Right/Enter toggle the state.

- ComboBox
Up/Down move to the previous/next control on the form. Left/Right navigate through items in the combobox list. Enter brings up a full screen list of the items for selecting by scrolling with Up/Down.

- TextBox
Up/Down move to the previous/next control on the form. Left/Right moves the caret in the textbox. The Back button erases a character. If the textbox is Multiline=true, Enter brings up a full screen textbox (with scrollbars, if needed):

+ The following two controls must be the only (interactive) control on the form (there is no automatic way for them to pass focus to another control):
- ListView
Up/Down moves through the listview items. Left/Right scrolls horizontally, if there is a scrollbar visible. Enter generates the ItemActivate event.

- TreeView (must be the *only* control on the form)
Up/Down moves through the visible treenode items. Left/Right scrolls horizontally, if there is a scrollbar visible. Enter expands/collapses a treenode.

+ Given the absence of buttons, the two soft keys are the main mechanism of performing actions. The following control is how we drive the two soft keys:
- MainMenu
When placed on a form, the two buttons directly under the screen become applicable. The mainmenu can only have two top-level menuitems, the Text of which is rendered on the screen buttons. The left root menuitem cannot have any child menuitems of its own and thus acts more like a button. The right root menu can have menuitems and hence may function as the normal menus we are accustomed to.

It is always good to cut code in order to understand a new platform, but I suggest you familiarise yourself with the platform philosophy before embarking on a project. Even if you are an experienced PPC developer, Smartphone is a new platform (in terms of UI - you can always use existing CF dlls without recompilation). I hope the above serves as a basis for understanding the philosophy and approach you should take for Smartphone development.

Other useful links for the newbie Smartphone developer:
Keys, menus, faq, msdn article, sp with cf primer, smartphone developer ng

Progress on RTL

Tue, March 22, 2005, 02:48 PM under MobileAndEmbedded
In the previous entry we identified how CF 2.0 does not support RTL on CE 5.0. We also defined what RTL support means.

Like with most features that CF does not support, we can work around this one with a bit of pinvoke. By reading this page on MSDN (thanks Chris Lorton) we see that, if we pinvoke SetWindowLong passing it the Control.Handle, we can change the RTL style.

In VS2005, to test if the above works, we populate a form with all the CF 2.0 controls and run the following method (e.g. call it from a button/menu click):
// Call this method with this.ChangeToRTL(this)
private void ChangeToRTL(Control c) {
this.ApplyStyle(c);
foreach (Control c2 in c.Controls) {
this.ChangeToRTL(c2);
}
}

private void ApplyStyle(Control c) {
Int32 lS = GetWindowLong(c.Handle, GWL_EXSTYLE);
lS |= WS_EX_LAYOUTRTL;
SetWindowLong(c.Handle, GWL_EXSTYLE, lS);

c.Invalidate();
}
To test the results you need a CE 5.0 device (or simply get the CE 5.0 emulator as described here).

I have given you enough to run the test and check the results for yourselves, but here is my summary (lookout for screenshots at the end):

1. The following controls pass the test and meet the criteria as defined previously:
button, label, textbox, checkbox, radiobutton, progress bar, v/h scrollbar, form, tabcontrol, datetimepicker, monthview, toolbar, statusbar, listbox

2. The following fail
domainupdown, numericupdown - text part right aligns but buttons remain on the right

trackbar - shade issue (need to change value for effect to take place; refresh is not good enough)

treeview - When ShowLines=true, the lines are portrayed the wrong way round

listview - columns do not right-align (they are not affected at all by the style-change)
listview - resizing a column looks funny. You drag to the right but the listviewitems below move to the left and vice-versa

MainMenu - The top mainmenu items do not change order, although they are aligned to the right (and correctly after the toolbar) menus - when clicking on toolbarbutton with a menu OR a mainmenu to bring down its menuitems, the menuitems appear to the left of the mainmenu/toolbarbutton.

combobox - It appears ok RTL *but* clicking on the dropdown button results in the list appearing but the main combo area disappearing. Clicking elsewhere to take away the focus results in the combobox being drawn to the left (it moves left exactly its width in pixels). Repeating the process eventually moves the combobox outside the form area on the left (kind of funny, really).

3. Vertical Scrollbar issue [treeview, listview, listbox, multiline textbox etc]
Regardless of what is described above, all controls that can have a vertical scrollbar work only if the style is applied *prior* to a vertical scrollbar being displayed. If the vscrollbar is visible and the RTL style is changed, then the vscrollbar stops responding (freezes) and remains on the right.

Screenshots:
Good RTL
Not so good RTL
Bad RTL
Menu RTL

If you have a CE 5.0 device with CF 2.0 on it, feel free to try the exe (in fact, if from IE on your CE 5.0 device you browse to this link, you can run it)

Blog link of the week 11

Sun, March 20, 2005, 02:57 PM under Links
+ If you think there is a scientific way classes are assigned to namespaces, think again.

+ I have thought about this before and, without going into details, I fundamentally disagree with the notion of "contextual keywords".

+ On the one hand I am not impressed with 35 blog entries in 2 days because I am not sure it is right to put such useful content into blogs rather than the traditional MSDN help (and MSFT do the former more and more). On the other hand, have you any idea how long we would be waiting had they taken this information through the stringent MSDN article submission process?

+ I have been bitten by this in the past, so follow the advice.

+ This neat little feature hasn't had as much exposure as it should IMO: incremental searching.

+ We will need this feature for an upcoming project, so I am bookmarking some info/links here on hosting the designer.

+ At some point I will blog about the process I followed when upgrading our VB6 system to .NET and then to CF. Until then, I'd keep my eye on Mike McIntyre’s blog (45 upgraded VB6 projects is a few dozen more than what I have done!)