Setting the tab order in a Compact Framework 1.0 application
Another one of my “learnings” from developing a CF 1.0 application (which I have to say is working a treat) relates to navigation. There is no tab order property for controls in a CF 1.0 application so if your UI develops “organically” as mine did (haphazardly may be a more accurate description) then you’ll find that as you navigate around the focus jumps all over the place.
You can get around this by manually editing the designer generated code modifying the order in which controls are added to the form. The tab order matches the order in which the controls are added. An easier way is to use the “Bring to Front” function in the designer. Right click on each control in turn in the order you would like to be the tab order and select “Bring to Front”. This will achieve the same effect as manually modifying the code. The only problem with each of these approaches is that Visual Studio has a tendency to overwrite your changes and undo all your hard work (it is designer generated code after all and it does say “do not modify the contents of this method with the code editor” :-)).
Of course you could just get the order right in the first place or, as Daniel suggested to me, you could take responsibility for that initialization code yourself and once you’re happy with the layout, cut the code from InitializeComponent() and create your own equivalent that you call in the form constructor. It’s an inconvenience more because you tend to forget and build and deploy and only realize when your focus jumps all over the place in the emulator. Anyway, it’s resolved in CF 2.0 which does support tab order.
I’m off to bonny Scotland for a week or so. More CF fun when I get back…