Tuesday, November 30, 2004

Why you should use Delphi

Nick Hodges does it again on codeFez. He asks again Why you should use Delphi. Well that kind of question keeps the discussion going. :-)

One of the points why you should use Delphi was:
Delphi has been doing “Avalon” for ten years.

Well that is just great. I never realized it myself but again this is, in my opinion, a great benefit for Delphi. First there was VCL then VCL.NET and, who knows, VCL for Avalon. Wow this really makes you think.
Winforms? Well that will definitly not make it to Avalon. (Again who knows, but you better read this.)
VCL.NET? Not such a bad choice, even if it will not make it to Avalon.
VCL? No problem, there is that beautifull upgrade path to VCL.NET, and maybe later to Avalon.........

Wednesday, November 24, 2004

Delphi 2005 first impressions...

Finally got the time to download the D2K5 trial, and install it!
Here my first impressions:

- Installation
Despite all negative news in borland non-technical-newsgroup the installation went very well. I did not have to install the .net framework so it took about 7 minutes.

- First run....
Oh yeah Delphi2005 really is a beast. It takes about 23 seconds to start the IDE, but then you will have everything from Win32 to .NET and ECO. (Delphi and C#)

Played a little while with all the demos. No crashes! And then ASP.NET.....

- ASP.NET
D8 was, somewhat, buggy in ASP.NET support. (Lost HTML code...) So far in D2k5 it looks great, and no HTML code lost so far. Will soon make a better test, because this is for me a main issue.

Still 29 day left.....

Tuesday, November 23, 2004

VCL.NET or Winforms, that is the question

Here a summary of links concerning the issue 'Why VCL.NET?':
Danny Thorpe: Why VCL.NET?
Borland: Overview ofVCL.NET?
Craig Stuntz: Choosing between VCL.NET and Winforms

Craig's article is an overview of considerations on using either VCL.NET and Winforms, reading it you might conclude that VCL.NET is not such a bad choice, because Winforms will disappear when Avalon comes in. So why bather converting your applications to Winforms?

Monday, November 22, 2004

ASP.NET: Positioning dynamic created controls

As shown in previous blog entry's it is pretty easy to create controls in runtime using ASP.NET.
Positioning this controls can be done using the Style property. In fact you can set your css style properties for the control.

This example shows how to create an image control in runtime and position it absolute at a given position.

MyImage := Image.Create;
MyImage.ImageUrl := 'images/test.gif';
MyImage.ID := 'myimage';
MyImage.Style['Position'] := 'Absolute';
MyImage.Style['Top'] := '400px';
MyImage.Style['Left'] := '100px';
Panel1.Controls.Add(MyImage);

ASP.NET: A reference to a webuser controls

Using webusercontrols gives great flexibility in building websites. Especially when you use in a dynamic way as shown in an early blog.

In designtime, however, you can not find a reference to a webusercontrol. In other words you won't find it in the control list of the object inspector. I'm not sure that this is common logic, however the solution is quit simple.

With the function FindControl, you can make a reference to a control and set it's properties.

procedure TWebForm1.SetMyWebUserControl;
var wuc : TWebUserControl1;
begin
wuc := FindControl('UserControl1') As TWebUserControl1;
If Assigned(wuc) then begin // Make sure it is there!
wuc.content := 'Got you!';
end;
end;

Where 'UserControl1' is the ID of the webusercontrol on the page.

ASP.NET: Web user controls, the dynamic way

One of the issues to overcome using Delphi.net and off course ASP.NET was how can I create my special webuser control dynamicaly in runtime.

First off all you'll have to add the unit, containing the webusercontrol to your uses clause.
The following code shows how you can add it:

procedure TWebForm1.AddWuControl;
var wu : TMyWebUserControl;
begin
wu := TMyWebUserControl(LoadControl('MyWebuserControl.ascx'));
pnlTest.Controls.Add(wu);
end;

Quit simple isn't it?
I generally use this technique when a repeater gets to complicated. Justing looping a recordset (? Ok DataReader) and create controls on a specific panel.

Sunday, November 21, 2004

D2005 Architect Trial download available

At the Borland download site, you can now download Delphi 2005.

Have fun! :-)

There is also a great reviewers guide with all the new, and existing stuff in Delphi 2005 .
You can get it at the Borland site here.

Use an image as your UIBarButtonItem

Using an image as your UIBarButtonItem in your navigationcontroller bar can only be achieved by using a common UIButton as the BarButtonItem...