Powered by discountASP.NET
referal ID: sdtref
Why recommend discountASP.NET?

Archives
Steve Trefethen Steve's RSS Feed Subscribe or via email
What's this?
Contact me Send mail to the author(s)
About Me
View my LinkedIn profile

Add to Google
Subscribe with Bloglines
MCP Microsoft Certified Professional

Falafel Software
ActiveFocus Project Management Solution by Falafel Software
Online or OnSite TestComplete Training
Blogroll
Recent Comments
My Online Tools
Stats
Total Posts: 460
This Year: 65
This Month: 1
This Week: 2
Comments: 1616
Tags
Disclaimer
The posts on this weblog are provided �AS IS� with no warranties, and confer no rights. The opinions expressed herein are my own personal opinions and do not represent my employer�s view in any way.
My most popular blog posts (Q1 2008)
# Wednesday, May 02, 2007
« A Delphi specific search engine | Main | Adding the Delphi Search Engine to your ... »

How to Install Components in the Delphi IDE

Posted @ 10:50PM by Steve Trefethen

Categories: Development

Tags:

Delphi 7 has a main menu option for Component|Install Component that guides you through the process of getting a component onto the Palette. Unfortunately, that functionality was lost in the IDE's transformation to the Borland Developer Studio. I won't go into details but I was not happy to say the least when I learned of this change.

Regardless, your choices of installing components hasn't changed it's just you're no longer guided through the process. I thought it might be useful to walk through a few scenarios using Delphi 2007. There are many ways to accomplish these tasks so don't consider this your only option.

Creating and installing a new component into a new Package
Here are the steps necessary to create a new component and get it installed onto the palette though refer to the section below on the caveat with the New VCL Component wizard:

  1. Start the IDE
  2. Select File|New|Package
  3. Select File|Save As and give your package the desired name
  4. Select View|Project Manager
  5. Right click the package node and select Options then be sure to fill in the Description for this package as it will be used in the Install Packages dialog
  6. Select Component|New VCL Component... which will display the New VCL Component Wizard (see note below)
  7. Select TButton as the ancestor and click Next
  8. Leave the defaults for Classname etc. and click Next
  9. Select "Add unit to Package1.bdsproj project"
  10. Select View|Project Manager and right click Package1 and select Install

That will get you a new design time package with a new component installed and on your palette. If you have an existing .PAS file that contains a component(s) all you need to do is right click the Contains node under your package and select "Add...".

Installing an existing component into a new package
The steps here are pretty much the same as above except at step 4 instead of starting the New VCL Component wizard simply open the .PAS file that contains the component(s) and add it to the Contains node of your package.

Installing components into an existing package
In this case, you've already created and installed a design time package and you'd like to add a new component.

  1. Select Component|Install Packages (Sure, this may seem a bit odd since the package we want is already installed)
  2. Find the desired package and select it in the Design Packages listbox
  3. Click the Edit button which will prompt you to cancel the dialog and open the package as a project
  4. Select View|Project Manager
  5. Expand the package node and right click the Contains node under the package and select "Add..." and add your existing .PAS file or select Component|New VCL Component and follow the steps above
  6. Right click the package node in the Project Manager and select Compile which will rebuild and reinstall your design time package

Installing existing design time packages
If you have existing component packages and you want to get them on the palette:

  1. Select Component|Install Packages
  2. Click the Add button and multi-select the design time packages you want to install then click Ok. You don't really have to worry too much if the package you select is design time or runtime as the IDE will let you know if there is an issue installing the package.

The issue with the New VCL Component Wizard
There is one rather major flaw with the New VCL Component Wizard and that's that it places both design-time and runtime code into a single unit. The runtime code is the code that implements the component itself. The design-time code is the Register procedure with the call to RegisterComponents which should be removed and placed in a different unit which belongs it a design time package. In the first scenario above it would be wise to create a second, design-time only package and split the code as described. Additionally, you should mark your packages explicitly as design-time and runtime using Usage Options from the Project Options dialog.

Mixing design-time and runtime code in a single package is a bad idea and needs to be  avoided. Design-time code isn't necessary at runtime and typically contains property and/or component editors along with various registration calls which are only meaningful when the package is installed in the IDE.

Let me know if this was helpful and if you've been impacted by the removal of Component|Install Component functionality. I've already discussed it with Nick Hodges.

[UPDATE: May 9, 2007] Also see Creating Packages from the Delphi wiki.

Thursday, May 03, 2007 6:50:06 AM (Pacific Daylight Time, UTC-07:00)
This does not appear to be working properly. If it is my problem, sorry.
Steve Gradijan
Thursday, May 03, 2007 7:50:35 AM (Pacific Daylight Time, UTC-07:00)
Steve,
What step are you stuck on? What error message, if any, are you seeing? Basically, what's not working? There isn't enough to go on in your comment for me to offer any further help.
Thursday, May 03, 2007 9:02:49 AM (Pacific Daylight Time, UTC-07:00)
Well, posting here did not seem to work again. Trying again.

Steve,

Blog did not post the first time I tried, then I decided I would rather send you a direct email. Can't seem to do that using "Contact me" button. I get the message I include at the end of this note. I would rather not send you here what I was going to send on the blog. Why the original response to your blog did not work on my first attempt to send the blog message, I do not know.

Can you send me an email direct as I can not send one to you. :(

Thanks for your reply.


Server Error in '/blog' Application.
A potentially dangerous Request.Form value was detected from the client (ctl08$comment="...oday.

<<Let me know if this...").
Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. You can disable request validation by setting validateRequest=false in the Page directive or in the configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case.

Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (ctl08$comment="...oday.

<<Let me know if this...").

Source Error:

[No relevant source lines]


Source File: c:\WINDOWS\microsoft.net\Framework\v2.0.50727\Temporary ASP.NET Files\blog\1be4009b\76f63391\App_Web_0dy-09ne.6.cs Line: 0

Stack Trace:

[HttpRequestValidationException (0x80004005): A potentially dangerous Request.Form value was detected from the client (ctl08$comment="...oday.

<<Let me know if this...").]
System.Web.HttpRequest.ValidateString(String s, String valueName, String collectionName) +3219534
System.Web.HttpRequest.ValidateNameValueCollection(NameValueCollection nvc, String collectionName) +108
System.Web.HttpRequest.get_Form() +119
System.Web.HttpRequest.get_HasForm() +57
System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +2025185
System.Web.UI.Page.DeterminePostBackMode() +60
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.email_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\microsoft.net\Framework\v2.0.50727\Temporary ASP.NET Files\blog\1be4009b\76f63391\App_Web_0dy-09ne.6.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


Steve Gradijan
Thursday, May 03, 2007 10:39:06 AM (Pacific Daylight Time, UTC-07:00)
As I've harped on for ages I've always thought Delphi's component installation was greatly lacking. This isn't as noticeable with small components but once you get into the medium sized components it becomes a messy, inconsistent mire of methods. Part of our training process for new hires is just teaching them all the different ways you can install components. The problem is that since Borland didn't set standards we now have to deal with...

- Full-blown stand-alone installers. These are great but rare, they offer full installation with IDE detection, package compilation, registration, updating search paths and creating uninstallers. The only downside is that they are harder to integrate into an automated "mega install" for quickly building out dev machines, but I'll gladly deal with that. Companies like RemObjects, DevExpress and Raize excel here.

- Attempts at generic installers. The two I know of are from Mustang Software, used for the VirtualTreeView and SilverPoint's MultiInstaller, which reads an INI and allows installing of multiple products. Both of these are actually very good options, except almost no one uses them and they aren't frequently maintained. I use MultiInstaller here at work to install 25+ component libraries, everything from Toolbar2000, DIRegEx, our own custom library, PBear's HTML, Abbrevia, FastMM, AsyncFree, etc. A good option but no one really uses it.

- Zip file + readme. Tedious and error prone since not everyone has the same instructions, often the readme isn't updated to take into account the newest folder layout and assumptions about the developers knowledge are often made. I've had to explain even to seasoned developers how to do certain things because the readme skipped steps that I'm sure seemed "obvious".

- The "Non-Installer Installer". This is the worst form of component installer. It's basically a folder structure that someone dropped inside an InnoSetup or NSIS install. It unpacks files and creates an uninstaller but does *nothing* else. No component registration, no detection of IDE, no library path update. They are horrible because they imply that they are installing something, that something more than an unzip command has been executed. I always end up repackaging these installs as plain zips so as not to lead on other developers. These cause me the most headaches because I get devs saying, "I installed component X but it's still not working..."

I would love to see Borland provide a way for component vendors of all sizes from the one-offs to the full blown to create installers that can do all the needed housework like install, compile, register, update, etc. They'd be able to both be run stand-alone as well as chained together for automated installs to quickly install many components. This would also mean that each new release of BDS would come with the requirements needed to properly register components. Something like this may have prevented the third-party component installer issues that Delphi 2007 had, meaning the fact that a lot of third-party vendors submitted their components for inclusion with 2007 *BEFORE* they were told about having to add extra logic for setting registry values to get MSBuild to pick up a new library path.

Sorry for the rant, this has always been a sore spot for me on an otherwise wonderful product.
Thursday, May 03, 2007 11:37:57 AM (Pacific Daylight Time, UTC-07:00)
It's clear to me that the success of the Delphi IDE will at least partially ride on the component market. I personally prefer to use components rather than write tremendous amounts of code for common tasks. (Isn't this what RAD IS?)

The ability for not only the enterprise dev house, but also the basic hobby user to drop in components easily seems vital.

Perhaps someone should write the new CEO a nice email about this? He appears to be listening. I understand it's poor form to write directly to the CEO of a company rather than a project head, but if he's listening, it's more than can be said for Codegear in recent times.
Andrew
Friday, May 04, 2007 4:36:48 PM (Pacific Daylight Time, UTC-07:00)
Steve,
Great post,
For me it is very helpfull, since I am moving more, and more into developing my own components, and your post plus Nick's tutorial helps a lot.
chris
Monday, May 07, 2007 9:38:03 AM (Pacific Daylight Time, UTC-07:00)
Good post, thanks.

Steve,
How do you think about D programming language? Is there a possible that CodeGear releases a IDE for D?
bigfoot
Monday, May 07, 2007 11:16:55 AM (Pacific Daylight Time, UTC-07:00)
bigfoot,
CodeGear is not focused on the D programming language. Since CodeGear is part of a public company and thus revenue is very important I'd say it may not necessarily be a wise choice to dive into a new language that has little to no user base particularly when there are other far more popular choices available but that's just my opinion.
Tuesday, May 08, 2007 8:25:39 AM (Pacific Daylight Time, UTC-07:00)
Thanks for the article, Steve! Are you aware that Rudy Velthuis wrote a tool for adding the functionality back into the IDE? I haven't used it myself, but assuming it's done well you may want to mention that it's available at http://rvelthuis.de/programs/compinstall.html
Rick Carter
Tuesday, May 08, 2007 9:16:49 AM (Pacific Daylight Time, UTC-07:00)
Shawn,
I hear you, there is certainly a need to make all of this stuff easier.

Rick,
Thanks for the link I didn't realize that Rudy had replaced this functionality and will check into it.
OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strong) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview