January 25, 2006
.NET CF Development in Delphi 2006
Ingredients
A copy of Delphi 2006 (that is, Borland Developer Studio 2006) and a PocketPC device or a PocketPC emulator.
Steps
1. Create a new WinForm application in Delphi 2006: File -> New -> Windows Forms Application – Delphi for .NET
2. Add a button to its form
3. Click on the button and add an event handler, like: MessageBox.Show('hello');
4. Change the project search path to refer to the CF assemblies: Project -> Options, go to the Directories/Conditionals page, replace the Search Path with "C:\Program Files\Borland\BDS\4.0\lib\cf" (or similar, depending on your installation).
5. Build, and you'll get errors for the 6 lines of code with properties/methods not supported by CF. Delete those lines (SuspendLayout, Name x 2, TabIndex, AutoScaleBaseSize, ResumeLayout).
6. Build again. Error in the project file on the threading model. Delete the line with "[STAThread]".
7. Build again.
8. You can now copy the resulting executable file to your PocketPC device, or move it to the shared folder of the emulator. It will work.
9. Add one line of code to the form constructor (Self.MinimizeBox := False;) to close the application automatically, otherwise deploying a new version will become complex, as you'll have to terminate the program from the PocketPC Control Panel.
Moral of the Story
Repeat with me: You don't need to use the command line, you don't need to use the command line, you don't need to use the command line, you don't need to use the command line, you don't need to use the command line...
Now you might wonder why I'm underlining this. The reason is that there is a BDN video by Tim Jarvis of Borland that implies you have to use the command line compiler unless you want to install third party tools in the IDE (the video "provides the rudimentary steps of setting up and performing CF development with Borland Developer Studio 2006" ). However, this is not the case. Delphi works better than Borland is telling the world and this is a pity. The video shows an unnecessarily complex approach.
Not only you can compile CF apps from the IDE, but after you change the Search Path, close and reopen the project, the Code Insight features (like Error Insight) will work against the CF assemblies. This means you'll be able to see coding errors like those introduced by the WinForms designer (and described earlier) directly in the editor even without compiling!
PS. I did get in contact with some people at Borland mentioning the problem but I didn't receive a
positive
reply.
9 Comments
.NET CF Development in Delphi 2006
I tried this with a bit more complex example (added some other components). Apparently the CF libraries do not have all of them, so i had to go back to your example. I noticed that whenever you edit the form, the constructor code is rebuilt and the deleted properties are added again.Comment by acordero on January 25, 22:32
.NET CF Development in Delphi 2006
Ryan wrote about using "a different dccil compiler". This was the case with the FC preview for Delphi 2005, but in Delphi 2006 there is only one compiler, which is "CF enabled". The existing compiler works OK. There is no special setting, compiler options... only you have to target the proper assemblies (or their dcpil imported images). As for Acordero comment, it it true that the CF libraries lack controls and components, and lack properties and methods of the available components. It is also true that every time you use the designer the "wrong" code is generated again... My suggestion is to use the designer up front and than edit the code manually to change the user interface or add event handlers.Comment by Marco Cantù [http://www.marcocantu.com] on January 26, 10:16
.NET CF Development in Delphi 2006
Marco, as I explained previously in email, the first BDNtv episode on CF development is intended to be an extremely bare bones CF development tutorial, discussing the underlying pieces of CF development, and not the most streamlined way to do CF development. We wanted to explain what was going on underneath the covers. There will be other CF BDNtv episodes that show easier ways to do this. Because I explained this to you in email before you posted this blog entry, I'm puzzled about you saying something like "I find it odd that Borland doesn't fully realise this". I hope this additional response clears up this misunderstanding for you.Comment by John Kaster [http://bdn.borland.com] on January 26, 20:01
.NET CF Development in Delphi 2006
John, my impression is still that you don't understand that the video in question harms Delphi sales. The video could show the "underlying pieces of CF development" using the IDE. It makes no technical difference to use project options or -lu command line parameters. But it makes a huge difference for most end users! I started this discussion (and emailing Borland) because I saw on an Italian Delphi forum the comment from a developer on the tone "I saw that video, so the CF is not really supported in the DBS 2006 IDE, we have to wait for Highlander for CF support". By looking at the video this is the impression you get. As this is not the case, I repeat: the video is misleading and is not good marketing at all, quite the opposite.Comment by Marco Cantù [http://www.marcocantu.com] on January 27, 07:23
.NET CF Development in Delphi 2006
"Bare bones", "showing how it works under the covers" does not mean that instructional videos that cloud the issues, are misleading, or incorrect. Delphi developers need to be shown "how" to do it, correctly. Help make us do things better, easier, faster with Delphi rather than with other tools. That's what Delphi 1 did.Comment by steve [http://stoponby.blogspot.com] on January 27, 21:20
.NET CF Development in Delphi 2006
The third session in the 24 hours of DeXter does a good overview of the integration the CF into Delphi 2006 Here's the stream url mms://bdntv.borland.com/replay/24%20Hours%20of% 20DeXter%200125-0150.wmaComment by Brian laym [http://www.the-wildwest.com] on February 7, 21:33
.NET CF Development in Delphi 2006
It's a pity that I wasn't aware from this Library Path issue when writing my article. I have tried it now. And indeed, it works great and it is nice that all Code Insight features are working. I have written a small update for my article so the world will know that developing Pocket PC applications with Delphi is very easy. I’m sure my modifications it will be online very soon.Comment by Stefan Cruysberghs [http://www.scip.be] on July 7, 21:43
.NET CF Development in Delphi 2006
Hi! I agree with Marco. I've watched the video and it scared me to use delphi for .cf. I have another q. Which device emulator and other stuff do you suggest to use to integrate it into delphi BDS 2006?Comment by hujšanje [http://www.aktivnadieta.si] on June 6, 16:14
Post Your Comment
Click here for posting your feedback to this blog.
There are currently 0 pending (unapproved) messages.


.NET CF Development in Delphi 2006
Comment by Ryan McGinty [http://www.slavetothecode.org] on January 25, 21:54