Thursday, July 27, 2006

Debugging CF applications on the PDA

In a previous post I mentioned that it's not a real problem that you cannot debug apps directly on your PDA because the application can be debugged on your desktop. Unfortunately this is not completely right, since it already has occured a few times that the desktop version behaved different after copying it to the PDA. So now I'm investigating the possibilities for debugging using the (free) Mdbg.exe tool . I found a good start at David Kline's CF Weblog. (to be continued..)

Tuesday, July 25, 2006

Intermezzo : Developers, developers, developers


The (in)famous 'Developers..' video by Steve Balmer.Probably everybody has seen this one. It's been on television, and you can find it on almost every website that tries to make fun of Microsoft. And even though I tend to think that it's a bit over the top, I sometimes just have to see this 19 seconds because it makes me feel good. Apart from the 'comic' level, it also has expresses a level of appreciation for 'us' developers that I seldom find in my everyday job. Don't get me wrong: I like, even love, what I do and I would probably make fun of anybody who would try to express some kind of appreciation. But sometimes I feel a little envy towards professionals that are more in the spotlights like journalists, politicians or actors. Let's face it, even the people that prepare the food for the people who cary the furniture in an everyday television series get their name mentioned on the title scroll...

Friday, July 21, 2006

Custom Components for the CF

After following all my own guidelines and creating a functional CF program for .NET2.0 ( the 'CFSimpleTerm' program, a serial communication terminal which you can find in the 'Downloads' section of C-Scope) I decided to start working on my first custom component. I found notes on the web everywhere that his was so simple in C#...
But ofcourse I wanted to create a custom component for the CF. Because one of the first things that strike you when developing CF applications (after finding out how 'simple' it is) is that the final application looks real 'basic', or even 'dull' I'd say. You cannot change fonts or colors of standard controls, and everything is flat (which is the standard for PocketPC's, I know, but I like it a little more fancy than that..). So I started out creating an enhanced button, with 3-D look, user definable color, and selectable font. Something like this:
So I used the 'Custom Component' wizard to create a 'xButton' class, derived from the standard Button. Something like this:

using System;
using System.Drawing;
using System.Windows.Forms;

namespace xControls
{
/// <summary>
/// Description of UserControl1.
/// </summary>
public partial class xButton : Button
{
private Color m_color1 = Color.LightGreen; //first color
private Color m_color2 = Color.DarkBlue; // second color
.... more code....

And this is what it looked like after two struggling two evenings with the .NET Drawing and Event override functions. Color, font and text alignment can be selected, and there is a basic 3D look.
Finally I copied a sample program using this xButton control to my PocketPC, only to find out that the button is still the same flat, grey one as in my previous applications :-(
So what went wrong ? Microsoft has the answer on this page. The following line explains it all:
"...most of the standard controls, such as Button, ListBox or Label, don't allow you to override the OnPaint event and add custom drawing to them..." So much for my custom button that overrides the OnPaint event. Fortunately the solution is also given here. Custom controls for the CF should always start from the toplevel 'Control' class, which does allow the overriding of the OnPaint. And, how convenient, the forementioned article contains a lot more hints and tips on creating a custom image button, so I suppose I had to start all over. I don't think just changing 'Button' to 'Control' in the class declaration will be sufficient. But ofcourse I did try it, just to see what happens. And to my (big) surprise, the program compiled without any warning, the button looked exactly the same when running the program on my PC, and... it also worked on the PDA ! So much for my first step towards what I hope will be a series of 'fancy' controls for the CF.
(Hey hey, but how did you actually do it ? Just look at the source here to find out...)

Wednesday, July 12, 2006

More CF compiling options

It's nice to see how suddenly more people start thinking along the same lines. Stefan Cruysberghs has created an article on the Borland developers network showing how to create CF applications using Delphi. I just read it, and it feels like a deja-vu, since it roughly follows the same procedure as in my previous posts. On the site of JED-Software you can even find a complete package to make Delphi more 'CF-Enabled'. Chee Wee Chua has posted a Compact Framework Project Preprocessor (MakeCFCompatible) to the Borland CodeCentral that's remarkable like my own CFPreProcessor. Ofcourse all of these solutions assume that you are the fortunate owner of Delphi 6 or the Borland Developer Suite 2006, and do not (yet) support .NET 2.0.