micheln
05-04-2007, 06:12 AM
Hi EveryBody
I'm trying to use MapPoint Inside my delphi application. I've read this very useful article: Using MapPoint In Delphi (http://www.mp2kmag.com/a65--delphi.example.mappoint.html) : it did work two months ago, but it does no more now!!
I followed all the instructions in the article, but when I try to run my application, I get the following error:
[Pascal Error] MyProject.dpr(14): E2018 Record, object or class type required :icon_frown:
Here is the code of Myproject:
program MyProject;
uses
Forms,
Main in 'Main.pas' {FrmMain},
MapPoint_TLB in 'MapPoint_TLB.pas';
{$R *.TLB}
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TFrmMain, FrmMain);
Application.Run;
end.
Besides, I can't find the activex tab in the component palette (neither MapPoint's TMap & Co, wherever I try to import the TLB?)
Where am I mistaking? :icon_frown:
Do I have to start BDS in .Net Personality to use MapPoint?
Thnk u for your help :-)
Wilfried
05-04-2007, 06:58 AM
Hi,
You dont have to include the TLB in your project. It only has to be in the uses clause of the units that really use it.
Line 14 is Application.Run ?
If so the the form's constructor runs without errors (but the problem can be over there as well).
Set some breaks in the begin of the following events of your main form:
FormCreate
FormShow
FormActivate
Also if you post custom messages in the FormCreate event you should set a break there as whell. Then you come to the line of the offending code.
micheln
05-04-2007, 08:49 AM
Hi,
You dont have to include the TLB in your project. It only has to be in the uses clause of the units that really use it.
Line 14 is Application.Run ?
If so the the form's constructor runs without errors (but the problem can be over there as well).
Set some breaks in the begin of the following events of your main form:
FormCreate
FormShow
FormActivate
Also if you post custom messages in the FormCreate event you should set a break there as whell. Then you come to the line of the offending code.
Again: thnk u a lot :yellowsmile:
I'm still learning so sorry for the 'wired' questions :oops:
I'll do that right now.
The problem is that I remember I Used to drag & drop the TMap component from the component palette on my forms and 'handle it' by code.
Now, it's no more possible: why that? I'm using BDS 2006 and mappoint 2006 (I tested it for the first time with BDS 2005 and MapPoint 2004): does this make any difference or explain the problem?
micheln
05-04-2007, 09:18 AM
That's AWESOME :tongue:
I just solved my problem (almost).
The fact is that I tried to import the TLB in the project (and was automatically included in the current project). I did't included Mappoint_TLB in the units.
But I still can't find TApplication, TMap in the component palette.
Anyway, I use mappoint with the OleContainer and IT ROCKS :lol:
If I manage to make a useful application (hopefully), I'll share it here.
Again: THANKS EVERYBODY: this forum is GREAT.
micheln
05-04-2007, 09:56 AM
I Still can't find <TApplication> in the component palette: any idea of why the problem? (If I can't figure out the problem, how will I find the solution :tongue: )
Wilfried
05-04-2007, 10:59 AM
Hi Michel,
Anyway, I use mappoint with the OleContainer and IT ROCKS :lol:
This is already great news :)
But I still can't find TApplication, TMap in the component palette.
I don't know. I stopped upgrading Delphi. Latest version I have is Delph7 and this one does not work with the ActiveX component, only the object model. But if it is not in the component pallette then, in my version it is 'import - activeX' or something...
danmincu
11-08-2007, 12:11 PM
Just move the *_TLB.pas file higher(top) in the DPR uses clause and you will get rid of "E2018 Record, Object or class type required" error.
Wilfried
11-09-2007, 12:36 PM
Hi,
Just move the *_TLB.pas file higher(top) in the DPR uses clause and you will get rid of "E2018 Record, Object or class type required" error.
Thanks for the reply. You right. Probably it is the conflict because Delphi has already an Application object, and now mappoint jumps in with an object of same name. Delphi search uses clause from bottom to top, so moving it solves.
You can also solve it by renaming the Application object to something else in the TLB. This was what I did. I think I called it _Application or __Application