Customizing C#Builder and Delphi 8 for .NET Welcome Page

By: Bob Swart

Abstract: In this article, I'll show you how to customize the C#Builder and Delphi 8 for .NET Welcome Page with some enhancements.

When you start C#Builder or Delphi 8 for .NET, the first thing you'll see is the Welcome Page. This page includes links to recently used projects or project groups, training, examples from code central (but not the examples on your own disk), on-line resources, and other Microsoft .NET solutions from Borland.

Note that you cannot remove the projects from the list of recent projects here, but you can manually edit - at your own risk - the list of recent projects in the registry at the key HKEY_CURRENT_USER\Software\Borland\BDS\X.0\Closed Projects. Replace X with 1 for C#Builder project, or 2 for the Delphi 8 for .NET projects. The five most recent projects are saved in that location.
The actual webpage, images and JavaScript (to retrieve the recent projects) can be found in the BDS\X.0\WelcomePage directory of your C#Builder (X=1) or Delphi 8 for .NET (X=2) installation. You can edit the default.htm file, change the d8welcome.gif image, or the JavaScript code. And that's exactly what we're about to do here, in order to illustrate and extend the capabilities of the Welcome Page a little bit.

File not found
I personally find it a bit annoying that projects that are no longer on my machine (and hence result in a "File not found" message) are still shown in this list. If you know JavaScript then you can edit the file bdshome.js file - at your own risk - in the WelcomePage directory, and at line 264, change it from:

    for(var rc=1; rc<FRowCnt; rc++) {
to:
    for(var rc=1; rc<FRowCnt; rc++) if (Cells[rc][1] != "File not found") { // BS
This is the easiest way (changing a single line of code). Note that "found" has a lower case "f".

Fly-over Hints
I've also heard complaints about the fact that when you place the mouse cursor over the links for the project files, you get "default.htm" in the statusbar, and not the name or path to the project. This is also easy to fix, using the onMouseOver event handler in JavaScript. Edit the bdshome.js file again (still at your own risk!), and change line 86 from the original:

    Text = "<a class=\"filename\" href=\"default.htm\" onclick=\"ClickMenu(" + Index + ")\">" + Text + "</A><br>";
To three lines that will use the filename as hint:
    Text = "<a class=\"filename\" href=\"default.htm\" " +         // BS
      "onmouseover=\"status='" + Text +  "'; return true;\" " +    // BS
      "onclick=\"ClickMenu(" + Index + ")\">" + Text + "</A><br>"; // BS
Note that you get the filename, and not the full path, however, since the full path would be far too long for most resolutions anyway. You can use a tweaked version of "Caption" instead of "Text" (in the second line) to get the full path. I leave that as exercise for the reader ;-)

Custom Links
And now let's consider the default.htm file itself. You can actually edit the contents and add your own links to it. As an exampe, Delphi 8 for .NET developers can feel free to edit the default.htm file in the BDS\2.0\WelcomePage directory, and change line 302 from a single <p> to the following (make it one long line):

  <font face="Arial" size="2">
   <a href="http://www.drbob42.com/d4dn/home.htm">Dr.Bob's Delphi 8 for .NET Clinic</a>
  </font><p>
so you will always have a link to my Delphi 8 for .NET page from your Delphi 8 for .NET IDE's Welcome Page (I couldn't think of a better place myself ;-)

Also, C#Builder users can insert the following line between line 204 and 205 in their copy of default.htm in the BDS\1.0\WelcomePage directory:

  <p><a href="http://www.drbob42.com/sidewinder/home.htm">Dr.Bob's C#Builder Visions</a></p>
which enables them to visit my C#Builder Visions site from the C#Builder IDE's Welcome Page.

Custom Images
Finally, feel free to replace the image d8welcome.gif (in the BDS\2.0\WelcomePage\Images directory) or the thinking_man.png (in the BDS\1.0\WelcomePage\Images directory) by other images. You can either replace the images, or edit the default.htm file (replacing the images, like d8welcome.gif might be easiest).

Warnings...
Note that all these changes that you make to bdshome.hs and default.htm are at your own risk. If the files should become damaged, you can always restore them from the Delphi 8 for .NET or C#Builder CD-ROM (but it's a good idea to make a local backup before you try to play with these files in the first place).
A final tip: you can change the bdshome.js and default.htm files, and see the effect of the changes without having to restart C#Builder or Delphi 8 for .NET, if you just click on the refresh link in the IDE.


Server Response from: ETNASC03