Tuesday, September 25, 2007

Blog searching

Blogger offers the posibility to search a specific blog with a query, which will return all the blogposts that meets the criteria.

For instance http://beensoft.blogspot.com/search?q=TWebbrowser will return all my blogposts about TWebbrowser including the Fooling around with series. Did not know that, thought I let you know!

Thursday, September 20, 2007

On with RAD Studio 2007 with mixed feelings

Yesterday I installed the RAD Studio 2007, over my existing Delphi 2007 for Win32 (Update 3) installation.
Installation gave no problem, except for a few packages that needed to be recompiled. Although I don't need RAD Studio 2007 anymore (since it does not have a winform designer), I was curious about the new ECO IV for VCL.NET.
Well it looks that ECO is only available in the Architect edition, which it was in the BDS2005 erra, as I recall. In BDS2006 it was introduced in all the SKU's at different levels.

Anyway I have mixed feelings for this release, at one hand it fast, stable (iow it rocks!), but on the other hand it misses important features compared to BDS2006.

Go Delphi for Win32!

Friday, September 14, 2007

Fooling around with TWebbrowser #3

Some more tips to make a webbrowser application that rocks!

Get the right popupwindow size
In episode #2 we managed to retain the ASP.NET Session for popup windows in our TWebbrowser application.
Initially we don't know what the size of our popup form must be. Fortunately TWebbrowser has two events for that, so that we can size our window accordingly.
Use the OnWindowSetHeight and OnWindowSetWidth event to do this.

procedure TfrmPopUpBrowser.WebBrowser1WindowSetHeight(
ASender: TObject; Height: Integer);
begin
Self.Height := WebBrowser1.Height + 20;
end;

procedure TfrmPopUpBrowser.WebBrowser1WindowSetWidth(
ASender: TObject; Width: Integer);
begin
Self.Width := WebBrowser1.Width + 20;
end;

The additional distance of 20, is to avoid scrollbars.

Filling up a combobox with the visited websites
If you use a combobox to harvest the visited websites, just like Internet Explorer then you could use the OnDocumentComplete event to get the complete URL and then add it to your combobox. I use this event for three reasons:

1. It gives you a complete URL (not www.codegear.com not http://www.codegear.com but http://www.codegear.com/)
2. If the typed address is not available (a non existing website) the OnNavigateError event will trigger, so you could then decide not to add the URL to the webbrowser.
3. Having a good URL gives the ability to locate the URL in combobox again if the user navigates back to the page.

You don't have this advantages if you add the URL into the combobox directly after input.

procedure TfrmPopUpBrowser.WebBrowser1DocumentComplete(
ASender: TObject;
const pDisp: IDispatch;
var URL: OleVariant);
begin
AddAddressToCombobox(URL);
end;

procedure TfrmPopUpBrowser.AddAddressToCombobox(
Adres : string);
begin
Adres := LowerCase(Adres);
If (Adres <> '')
and (cboAddress.Items.IndexOf(Adres) = -1) then begin
cboApplication.Items.Add(Adres);
end;
end;
end;

Enable/Disable navigatebuttons (back/forward) automatically
If you put two buttons on your form to navigate back and forward in the webbrowser you will get an error if there is no page to go back to. (Webbrowser1.GoBack and Webbrowser1.GoForward methods)
You can use the OnCommandChange event to make this buttons 'case sensitive':

procedure TfrmPopUpBrowser.WebBrowser1CommandStateChange(
ASender: TObject; Command: Integer; Enable: WordBool);
begin
case Command of
CSC_NAVIGATEBACK: tbApplicationBack.Enabled := Enable;
CSC_NAVIGATEFORWARD: tbApplicationNext.Enabled := Enable;
end;
end;

Add a progress bar to your application
If you want to see the load progress of a page then use the OnProgressChange event.

procedure TfrmPopUpBrowser.WebBrowser1ProgressChange(
ASender: TObject; Progress, ProgressMax: Integer);
begin
ProgressBar.Max := ProgressMax;
ProgressBar.Min := 0;
ProgressBar.Position := Progress;
end;

Have the url in your statusbar or label
Use the OnStatusChange event to show the navigated address in a label or statusbar.

procedure TfrmPopUpBrowser.WebBrowser1StatusTextChange(
ASender: TObject; const Text: WideString);
begin
StatusBar.SimpleText := Text;
end;

Thursday, September 13, 2007

SA or not SA

Is SA worth while?
This is what Bruce McGee asks himself (and us) in this blogpost.
From a financial point of view it is a good deal. Personally I am very disappointed with my first SA experience.

Together with the Delphi 2007 for Win32 edition I bought software assurance because I tend to use the Delphi .NET personality for my winforms development (What was I thinking?). At that time nothing indicated that the winforms designer was not in the RAD Studio later that year.
Now that RAD Studio is out, it is kind of funny (ahum sad) that there is no reason, for me, to even install it. The Update 3 is all I need.

Is SA worth while?

Wednesday, September 12, 2007

Fooling around with TWebbrowser #2

In the last episode of this serie (9 january 2006) we talked about the fact that we could use the TWebbrowser component to display simple webpages within our Delphi application.
Recently this project extended and was used to hold a complex ASP.NET webapplication, which gave some additional problems with the ASP.NET Session object. The problem is that this webapplication popups several windows (Internet Explorer windows) which looses the session of the webapplication.
As a result the user must login on every browser, which is a showstopper of course.

The cause of this is that the webserver sees our application as a different process compared to Internet Explorer. (ASP.NET sessions are process dependent) Different process, different session. The solution of this was rather simple, although a little hard to find.

How to retain the browser session within your application
The trick is to get the popup to run into the same process as our application, so basically to run it in our application.
TWebbrowser has a NewWindow2 event for this. In this event you can specify the application to be used throught the ppDisp (IDispatch) parameter. (our application, in this event)

Suppose you have a second form, Form2, containing another TWebbrowser, you could 'redirect' the new window like this:

procedure TForm1.WebBrowser1NewWindow2(ASender: TObject;
var ppDisp: IDispatch; var Cancel: WordBool);
begin
ppDisp := Form2.WebBrowser1.Application;
Form2.Show;
end;



Quite simple, isn't it?
To let our form act in the window-name resolution it is wise to set the RegisterAsBrowser property to true.

More information can be found on knAlertz:
How to maintain the ASP.NET session state
How to use the WebBrowser control NewWindow2 event in Visual Basic .NET

Monday, September 10, 2007

VB developers, now is the time to shift to Delphi

Every now and then the discussion on how do we get 'the abandoned VB6 developer' into Delphi community pops up.

If you are VB developer, who wants to get into Delphi, now is the time to move to Delphi! If you do, and you should, you might find one of the following links usefull:

Delphi versus VB
- Delphi for Visual Basic developers by Delphi About
- VB to Delphi at Cyber Matrix.
- Migrating from VB to Delphi Whitepaper (PDF) by CodeGear.

Delphi the IDE, and the language
- Marco Cantu's essential Pascal all about the basics of Object Pascal, the language used in Delphi.
- Marco Cantu's all about Delphi Essential Delphi the IDE combined with the language.
- Zarko Gajic's delphi.about.com, with lot's of tutorials and sources.
- Delphiland offers online lessons for beginners and intermediate users
- Delphi basics provides help and reference for the fundamentals of the Delphi language.

Delphi the community
- CodeGear Delphi product page
- CodeGear Developer Network Delphi
- Delphi Newswhat Newsgroups and Blog aggregator
- Also via newsgroups.codegear.com.
Tip! Don't miss the Delphi non-technical newsgroup!

Books on Lulu
All Delphi books on Lulu
Marco Cantu's Delphi books on Lulu
Bob Swart's books on Lulu

Delphi wikis
Delphi Video's
Delphi Useful sites

Delphi blogs
Delphifeeds blog aggregator

More resources?

Wednesday, September 05, 2007

CodeGear RAD Studio 2007 announced

CodeGear announced in this press release the upcoming new version of BDS 2006 / Delphi 2007 for Win32, now called CodeGear RAD Studio 2007, to be available this month.

More information can be found on the RAD Studio product page.

Update! Technical datasheet is available here.
Much more links (product pdf's etcetera) can be found on David I's blog here.

Friday, August 31, 2007

Delphi for PHP Update #2

Delphi for PHP Update 2 is available!
Download it here.

Go get it! It contains fixes, improved documentation! and an updated VCL for PHP.

Wednesday, August 29, 2007

ADODB Promptdatasource in .NET

In Delphi Win32 it is very easy to use the standard Windows OleDB datalink connection dialog to build Connectionstrings at runtime.


It is as simple as this, use ADODB and you have the PromptDataSource function:

ConnString := PromptDataSource(Handle, ConnString);

In .NET however it is a little more complex. To make a function that can do this, you must first add references to both the Microsoft ActiveX Data Objects 2.8 Library (=ADODB namespace) and the Microsoft OLE DB Service Component 1.0 Type Library (=MSDASC namespace). In C# the code looks something like this:

private string PromptDataSource()
{
MSDASC.DataLinks dataLinks = new MSDASC.DataLinksClass();
ADODB.Connection connection = new ADODB.ConnectionClass();
object oConnection = (object)connection;
if (dataLinks.PromptEdit(ref oConnection))
return connection.ConnectionString;
else
return "";
}


In Delphi .NET the code looks like this:

uses ADODB, MSDASC; (Add to your uses clause).

function TForm1.PromptDatasource : string;
var
Datalinks : DataLinksClass;
ADOConnection : Connection;
oConnection : TObject;
begin
Result := '';
Datalinks := DataLinksClass.Create;
ADOConnection := ADODB.ConnectionClass.Create;
oConnection := TObject(ADOConnection);
if Datalinks.PromptEdit(oConnection) then begin
Result := ADOConnection.ConnectionString;
end;
end;



In Delphi .NET it is wise to remove the namespace prefixing.
Default there is a prefix Borland.VCL. If you don't remove that the compiler will use the Borland.VCL.ADODB namespace instead of the ADODB namespace from the COM import.
You can do this in the options dialog under Tools.
(Or alter your project specific namespace prefixes in the project options)

Highlander, can't take that long, can it?

It just can not be taking that much longer (in time) that Highlander (Rad Studio 2007) will hit the doorsteps. There is a lot going on, like the beta blogging, and sheduled RAD 2007 Chats and sheduled RAD Studio 2007 Developer Days.
(Taking place 5, 12, 13 september)

There are some nice beta blogging entry about the new kid on the blog.

Generics:
Bob Swart shows some generics
Hallvard Vassbotn has a very detailed overview of generics and other new language features.

ECO IV:
Peter Morris has a detailed overview of ECO IV
Dave Clegg shows, in this CDN video, ECO IV with VCL.NET
Olaf Monien shows XAML coding using .NET 3.0/WPF.

Blackfish:
John MosHakis has some information about Blackfish SQL

Intresting CodeGear blogposts
Dee Elling talks about the improved help

No, no doubt RAD Studio 2007 is coming! (Real soon now?)

Friday, August 17, 2007

Monday, August 06, 2007

Back online, catching up and the human compiler

After spending three weeks in Italy (Adriano-Ravenna) on the Adriatico coast, touching no computer at all (except my PDA) it is now time to start things up again.

Catching up the Delphi scene

It looks like Delphi update 2 is coming real soon now. (It seems someone slipped some readme file)

Nick Hodges reveals the things that are not on the roadmap, with, of course, the stopped .NET 2.0 Winform designer which I blogged about sometime ago. He talks about why development was stopped, which is understandable from their standpoint of view. Developers who does not use Delphi .NET winforms are, of course, happy about it. However for those that used Delphi .NET for Winforms since Delphi 8 they will have to move away from Delphi for that type of applications. But you know: Sh*t happens, step over it

There is a nice (new?) site called codegearguru.com with a lot of video tutorials. Have not dived into it, but it looks good.

Marco Cantu is working on a Delphi 2007 handbook.

Steve Peacocke has some nice blogposts about the history of Delphi/Pascal.

The human brain is a cool compiler
I tend to read some, not computer related books, on holidays. This year I had some book about the human brain and how it works.
Did you know that the human brain does not have to read all the letters in a word to understand the meaning of the word? Only the first and last character of a word must be in the right place. Let see if this is true, can you read this?

So Ceagoder is cionmg rael soon now wtih udptae 2 of Dlehpi. Is tihs not amnzaig? If tihs cuold be ileemepnmtd in teh coepimlr it wuold gvie lses erorrs on tpoys!

Well OK, back to work!

Thursday, July 05, 2007

Some IDE Experts

Triggered by some comments in my previous post I have digged a little into some available Delphi IDE Experts.
So far I found and used (not completed tested) the following:

1. Castalia
Castalia has two comboboxes on top of the Delphi editor, with the classes and methods of the current unit, which are great for navigating your source. Another nice feature is structural highlighting, where lines are placed between the begin and end blocks of your source. A free Castalia version is available for registered BDS 2006 users.

2. GExperts
GExperts offers lots of extra functions in the editor. To name a few: Find procedure, reverse statement, replace and rename component functions. The rename component function helps you to use your component naming convention wisely.
GExperts is open source.

3. DDevExtensions
DDevExtensions offers some nice, more technical, functions. If you don't like the BDS 2005-2006 and Delphi 2007 tool palette, DDevextensions allows you to use the old style tabbed tool palette. DDevExtensions is freeware.

4. cnPack
I have not yet used it very much, but it offers lot's of functions to help you to be more productive. cnPack is freeware.

Anyhow IDE experts can help you be even more productive in the Delphi environment.

I am sure there will be more out there, so if you have/know another one please leave a comment! (I will add it to this list)

Btw if you want to make your own expert, these links are a good start point:
Experts and Wizards in Delphi (delphi.about)
Delphi Open Tools API Nice overview and tutorial by Mustangpeak.

Friday, June 29, 2007

Some IDE enhancements to consider...

The Tool Palette has this great option of filtering its content. Give it the focus (or click the filter button) and start typing. For example you will find all the type of buttons when you type 'butt'.


This is just great!

Today I had to search a unit for specific functions, and you can search the code structure with the structure pane which is a list of all the components and methods of a unit in alphabetic order.


Would it not be nice to have a filtering option on the stucture panel too? Just type 'Formc' and you have your FormCreate event.

Taking this idea a step further, also the Object Inspector and Project Mangager could benefit from such an option.

I am not sure if anybody already came up with this, but if it is in Quality Central I sure would like to vote for it. (Did not find it yet)

Wednesday, June 27, 2007

The day after...more options?

Ok, CodeGear drops Winforms. It is now clear that I belong to an exclusive group of Delphi .NET Winforms developers out there. That sounds cool, but they now have a little problem, driving their applications into the future. I am not happy about this affaire, but live goes on. Time to sort out my options.

What was I thinking, doing Winforms development in Delphi .NET?
As I told you before I use(d) Delphi .NET Winforms for only few applications belonging to the same project.
This project is a VCL Win32 project, built up in a couple of modules (read seperate applications) which I started two years ago. Why VCL Win32? Simple Delphi is VCL
The last two modules needed Gauges and Charts. At first I builded this in VCL Win32 with TMS Software's Instrumentation workshop, however my client came up with the Dundas Gauges and Charts. And he was right, these are a class on their own.
Of course this were .NET components, which I could not use in Delphi Win32. So a decision had to be made. Basically there were two options Delphi for .NET Winforms, or VS C#. (I tried to wrap them into VCL.NET, but that did not work)
Although the controls were built for VS.NET (and supported), I choose for Delphi .NET for the simple fact that I could reuse my coreclasses by sharing them between my Win32 and .NET projects.

Bringing my Delphi for .NET Winforms apps into the future
No panic, however at some point in time I probably have to upgrade my applications to 'something else' (Or I will have to install BDS2006, and .NET 1.1 framework, for the rest of my life ;-))

At this point I think that my only option is to bring the projects over into VS C#.

More options?

Saturday, June 23, 2007

CodeGear to drop winforms designer in Highlander

Early june the roadmap for Delphi and C++ Builder was published. At first sight I found it a good roadmap.
It became even better with the updated one, where the nice codename Commodore for a 64 bit Delphi was introduced.
I first became a bit worried by a blogpost of Devexpress CTO Julian Bucknall who somehow managed to read between the lines. What he read was that C# Builder and Winforms support was dropped (Kaput as he says). His exact words:

There's no mention of the WinForms designer. Indeed, as I understand it, it's kaput. You should be using the forms designer that targets VCL.NET.

Huh? Let's take a further look at the roadmap, it says:

"Highlander" is a planned release that is both a major upgrade to Delphi .NET and a roll up of Delphi 2007 for Win32 and C++Builder 2007 into the complete 2007 RAD Studio. Highlander is planned to enhance Delphi's .NET support up to .Net v2.0 including both framework, design, and language enhancements.

Delphi developers will be able to develop rich, full-featured websites using RAD techniques and ASP.NET 2.0. VCL developers will be able to easily migrate code to managed code using VCL.NET. Delphi developers will also be able to use model-driven development to drastically improve their productivity.

Specific areas of focus under consideration for Highlander are: ... etc


OK search the roadmap for Winforms and, yes, it is not mentioned. But highlights in the above quote: major upgrade to Delphi .NET, enhance Delphi's .NET support up to .Net v2.0 including both framework, design, and language enhancements

Oh well Julian must be wrong, it will all have to do with C# Builder. Dropping C# Builder, hmmm I can imagine such a decision. Because C# Builder is in fact the Microsoft C# compiler and C# syntax = C# syntax.

Well he was not wrong, in fact he had it right. After reading this non.tech thread it was all clear to me, someone asks:

Will there continue to be a Winforms designer for Delphi for .Net? Because,
that's what our ECO applications are using and we are using DevExpress .Net Winforms components. Especially, after reading Julian's blog entry of
yesterday.


and Nick Hodges from CodeGear replies:

> Will there continue to be a Winforms designer for Delphi for .Net?
No -- we aren't going to be supporting Winforms going forward.


Shock, WTF, no more winforms support???
How can a roadmap talk about design enhancements, but in fact drop it?

Delphi .NET, the history
Before I continue it is good to take a brief look at the history of Delphi in the .NET world.
Delphi entered the .NET world, announced as a first class .NET citizen read about it here. First class with everything on it. It was a evolution, instead of the revolution, so Delphi developers could embrace .NET the easy way. Well it turned out that Borland/CodeGear had to play catch up with Microsoft. .NET 2.0 support is still not here.
I remember once at a Delphi launch, here in the Netherlands, that someone asked when will Delphi support .NET 2.0? The anwser: Within a few months after its release. OK we know that a few month became a few month more, but what the hack we can wait, we want to do Delphi, also in .NET!

Finally its there, but it is crippled without the winforms designer support.

What does this mean for Delphi.NET Winform developers?
This one is not hard to answer. Delphi .NET and C# programmers will have no form designer if they move forward to .NET 2.0 and beyond. Be assured you can manually code your design (Yeah, yeah I am looking forward to that...) and compile your code. So basically they are forced to move to either VCL.NET or VS. The first option, VCL.NET, is, imo, not a real option because the lack of thirdparty components. So the only valid option looks to be, to move on to VS. This will drive those developers away from Delphi, is that the goal? I doubt that.

What does this all mean for Delphi as a product?
Well I can only write down my own opinion here, but I think it is a bad mistake. Whether we like it or not .NET will become more and more the synoniem for Windows Development. Win32 will be supported for a long, long time but from a business point of view as well from a personal point of view (jobs) you can't deny .NET when you development has a focus on Windows. You just can't.

What for appeal has a .NET IDE with only ASP.NET support?
Personally I think it is more logic to have an IDE that support both.

Is VCL.NET a true alternative for Winforms?
I don't think so. I don't know if it is used often, but it seriously lacks thirdparty support.

I think that Delphi will continue to be strong on native Win32/64, but its .NET participation will decline.

What does this mean for me?
I always tried to pick the right tools for the right job. At this moment I do projects in Delphi 2007 Win32(60%), Delphi .NET(10%) and Visual Studio 2005 C# ASP.NET(30%).
In the long term I will probably move my Delphi .NET applications to VS C#. Fortunately they are not that big, but it will cost me some time. I think it is a pitty, because VS2005 has also it's quirks. Even now I find that Delphi .NET (the IDE) has some advantages compared to VS. (Still can't get used to the endless list of tabs in VS)
Delphi will stay to be my number one tool in the Win32/64 native development world, but on .NET it will be another story.

The roadmap
Nevertheless the roadmap has some great things for the near future (Unicode, Win64). However I find it a bad sign that the roadmap is not clear on the Winforms departure, which has great impact on the developers using it.
It seems that messages from CodeGear now, and Borland in the past, are still driving confusion, and that will affect its customers, and eventually CodeGear self.

Sunday, June 10, 2007

Trouble installing update #1, frozen Collecting Information page?

Installing Delphi update #1 on my desktop machine was smooth and rather fast ( less than a hour). On my laptop however it was a different story. :-(
The installation was "frozen" on the Collection Information page. Something that took only 5 seconds or so on my desktop PC.
After waiting for 3 hours I killed the process and downloaded the 700 Mb installation from CodeGear here.
Again all "hanged" on the Collecting information page. Having not that much patient anymore I killed the setup process within a hour.

Fortunately Robert M. Lincoln had just posted a thread in the non-tech that he had the same problem and solved it by disabling all the startup apps using the MSConfig.

(3) This time, I ran MSCONFIG, and disabled allstartup programs (using "Selective Startup", uncheck"Load startup items", leave checked "Load SystemServices", "Use original boot configuration" is checkedand greyed out). After rebooting, I ran as in (2) aboveusing the DVD from the ISO file.This time, success!

Installation was just as fast as on my desktop PC! :-)
Now wondering what app blocked the installation?

Saturday, June 09, 2007

Delphi / C++ Builder roadmap

The Delphi and C++Builder roadmap is available on the Developer Network.

Basically it drills down to this:

Second half 2007: Delphi "Highlander"
Containing support for .NET 2.0 en .NET 3.0 compatibility. All personalities will be in the Rad Studio 2007.

First half 2008: Delphi "Tiburón"
This version is about Unicode and Generics

Somewhere in 2009: Delphi "Tiburón +"
Native 64 bit support (VCL for Win64)
Support for multi-core/multi-threaded development

The direction of this roadmap seems to be OK. But that all depends strongly on what technologies you use. Overall I think it is a good roadmap.

All the details in the roadmap.

Thursday, June 07, 2007

Delphi 2007 update #1 is available

Delphi 2007 Update #1 is available for registered Delphi 2007 users. It will come through the automatic update function, or in the traditional way as a download here.

As you can see the update will uninstall you current Delphi 2007 installation, and then reinstall the one with the update. First question that raises is:

Now I will have to reinstall all components again?

The answer is No, you don't have to reinstall all components, as stated by Nick Hodges in this non-tech newsgroup thread. His exact words: "Nope -- all your settings will be retained. " .

Another tip, have your serialnumber available, because it is required for the install. (In case you are at home and the serials are in your office ;-) )
Updated: Argg I did not read the Installation notes properly, as Dave Keighan says in the comments it is not necessary to have your serials. (Only for new installation I guess) I could install update 1 immediately after all. ;0

More info in the Installation Notes for Delphi® 2007 for Win32® Update 1 document.

Monday, June 04, 2007

Delphi 2007 update #1, coming soon

Chris Pattinson posted the QC list for the Delphi 2007 Update #1.
More then 300! fixes is this update.

Read the complete list at this CDN article.

The update should come automatically for registered users through the new installer function, "Check for updates"

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...