2009. június 13., szombat

Delphi 4/5 and Formula 1 Spreadsheet ActiveX control


Problem/Question/Abstract:

I ran into some problems when upgrading a work environment from Delphi 4 to Delphi 5, where the Formula 1 Spreadsheet ActiveX control (OCX) was involved.

Normal installation of an OCX:

Menu 'Component | Import ActiveX Control'

In the list of ActiveX controls, select 'VC Formula One'. If it is not in the list, use the 'Add' button to insert the OCX (\winnt\system32\vcf15.ocx)

Option step: Hit button 'Create Unit'. This will create an import unit 'VCF15_TLB.PAS', by default into this directory: \Delphi5\Imports\. The 'TLB' means 'Type Library'.

Hit Button 'Install'. If needed, this will create the import unit (see previous step). Then this import unit will be added to a - selected - package.

Open this package, compile and if necessary install it.


This procedure worked fine for Formula 1 with Delphi 4. However, when I had Delphi 5 create the import unit, I ran into these problems:

// ************************************************************************
// Errors:
// Hint: Member 'Type' of 'IF1FileSpec' changed to 'Type_'
// Hint: Member 'Type' of 'IF1NumberFormat' changed to 'Type_'
// Hint: Member 'Type' of 'IF1Book' changed to 'Type_'
// Hint: Parameter 'Array' of IF1Book.CopyDataFromArray changed to 'Array_'
// Hint: Parameter 'Array' of IF1Book.CopyDataToArray changed to 'Array_'
// Hint: Member 'Type' of 'IF1BookView' changed to 'Type_'
// Hint: Parameter 'Array' of IF1BookView.CopyDataFromArray changed to 'Array_'
// Hint: Parameter 'Array' of IF1BookView.CopyDataToArray changed to 'Array_'
// ************************************************************************

To make matters worse, when trying to compile the package file, I would get incompatible type errors in these lines:

property ColWidth[nCol: Integer]: Smallint read Get_ColWidth write Set_ColWidth;
property RowHeight[nRow: Integer]: Smallint read Get_RowHeight write Set_RowHeight;

Answer:

I found that the manufacturer puts an import file into the Formula One directory. The name of this file is 'VCF15.pas' (instead of 'VCF15_TLB.pas')

So I had to go through all my source codes and in the uses clauses replace VCF15_TLB with VCF15.

I also noticed that arguments of type 'WideString' had to be replaced with 'String' in Delphi 5.

After these steps, I can now compile applications under Delphi 5 that use Formula 1 and the deployed executables work.

Nincsenek megjegyzések:

Megjegyzés küldése