views:

184

answers:

1

This is probably a really simple question, but here it is. I just renewed my license for the DevArt DBExpress driver for Firebird. The help file says I can use their freeware DBMonitor application with it but since I am using D2006, I have to use these instructions:

"If you are Delphi Pro version user, then you don't have TSQLMonitor component installed on the palette, but it is included in SQLExpr.pas unit and you need to install it on the components palette manually."

I can create an instance of TSQLMonitor in code, configure it and use it, but if I did want to put it on my palette, how do I do that? I guess I can put it into its own unit and add it to the dcluser package, but is that what I should be doing?

Thanks for your help.

+1  A: 

You should add it to a design package, and re-install the design package, but before installing the package, you should make sure component registration code is added to the package too.

Check the source file, SQLExpr.pas, and look for Register procedure in the interface section of the unit. If it doesn't have such a procedure, you have to add it manually:

Add a procedure definition to Interface section:

procedure Register;

then implement it in Implementation section like this:

procedure Register;
begin
  RegisterComponent('Devart',[TSQLMonitor]);
end;

Instead of 'Devart', you can use any palette name you like.

Then you have to save the unit, add it to a design package, and install the design package. Delphi IDE will register the component and add it to component palette.

Regards.

vcldeveloper
I made the changes you suggested to SQLExpr. Then here's what happened. I opened up dclusr.dpk and added SQLExpr.pas to it. The IDE added two files to the Requires list in the Project Manager window. It added dbexpress.dcp and dbrtl.dcp. When I tried to compile the project, it gave me an error message: [Pascal Error] dclusr.dpk(45): E2200 Package 'dbexpress' already contains unit 'SqlExpr'This is probably why I mostly stay away from doing stuff with packages. To compile SQLExpr, I need to include dbexpress.dcp. If I include dbexpress.dcp, then SQLExpr won't compile.
OK, if package dbxpress already contains SQLExpr.pas, then just modify SQLExpr.pas unit, save it, and install dbxpress package. If the unit called SQLExpr in dbxpress package is different from the SQLExpr unit that you are supposed to change(i.e. two different units with similar names), then you should rename your SQLExpr unit to something else, and then add it to one of your design packages. It's better you choose one of Devart's design packages.
vcldeveloper
I marked your answer as the accepted one. It appears that DBExpress is included in binary form only in my D2006 Pro. Therefore, I think that I cannot modify SQLExpr.pas (and the DBExpress package) and reinstall. It looks like I will have to copy the code for the component out into a new unit and include that unit into dclusr.dpk. I can handle that. Thanks for your help.