MapWinGIS_TLB.pas Problems with Delphi XE5

I am having trouble getting the new MapWinGIS into Delphi XE5.

I have tried bringing in the supplied “MapWinGIS_TLB.pas” file but there are errors highlighted in the code.

I get this:

"_Unit "MapWinGIS_TLB.pas" references the “Visual Component Library” framework, but the project currently has no framework assigned. Do you want to enable the “Visual Component Library” framework for this project?
(Not enabling the proper framework may require unit scoping, ambiguities, and linkage to framework binaries to be handled manually)
Yes No Cancel

I select “Yes” then I get a compile/build error on the “begin” line in the following function
function TShapefile.SelectShapes(const BoundBox: IExtents; Tolerance: Double;
SelectMode: SelectMode; var result: OleVariant): WordBool;
Result := DefaultInterface.SelectShapes(BoundBox, Tolerance, SelectMode, result);

I would be very grateful if anyone has an answer to this.

Best regards

Hi James,

The TLB.pas was made by importing the MapWinGIS.ocx file (v into Delphi 10.1 (Berlin) using the Import Component option. After that, I went through and changed all the component type names, adding the Tmw prefix to names (Mapwin had a bunch of components with names like “table” that are already used in other Delphi units).

I’m not exactly sure why you are getting the build error, but I suspect it is due to namespaces being handled differently in XE5 vs Delphi Berlin. In particular, you may need the “Vcl.” namespace prefix added to some of your units - just a wild guess! (BTW - I think you didn’t tell us what the actual compile error message is did you?). Not sure also what version of Windows you are using and whether you are compiling 32- or 64-bit Delphi compiler.

Overall, I think you have two options:

  1. Re-import the OCX into your own version of Delphi and do what I did to rename components in the created TLB.pas file, or
  2. Play around with prefixes to your units. See this post which gives some further info on this:

Finally, a quick word of encouragement. Once you get it properly embedded in Delphi Mapwingis.ocx seems to work great. I’d be happy to keep interacting with you about its use in Delphi as there’s not many of us trying that I believe! I’m using it as part of a larger program that does modeling of air pollution and its impacts. See: You can reach me here:

Good luck!


Hi Charles

Thanks for the advice.

When I get some time I’ll give it a go.

Hi Charlie

Still having trouble with this. I have imported the “OCX” which now appears as a bunch of components in the forms designer. I can drop these on the form. When I hit run the TLB code window opens stating “redeclaration of Result” error.

I am very inexperienced with importing TLB components… last time I did that successfully was to import some Excel_TLB stuff for excel automation… but that was 15 years ago in Delphi 7 on Windows XP.

I am currently on Delphi XE5 running on Win 10 Pro.

What sort of information do you need to advise me further (if you have the time and inclination - obviously)?

Hi again James,

Sorry for the slow reply. I think the issue may be that Delphi itself (or your app) already has objects declared with that name and so MapWinGis components are clashing with your current code. I noticed that MapWinGIS has components that use names that are already in common use in Delphi, like “table”, “image” and “grid”. I dealt with this by manually editing the MapWinGIS_TLB file and giving ALL the high level components the prefix “Tmw” (e.g. TmwGrid). This worked well.

Take a look at the edited code at the end of the unit that registers all the components with Delphi:

RegisterComponents(dtlServerPage, [TmwShapeEditor, TmwGrid, TmwGridHeader, TmwESRIGridManager, TmwImage, TmwShape, TmwShapefile, TmwExtents, TmwPoint,
TmwTable, TmwField, TmwShapeNetwork, TmwUtils, TmwVector,
TmwGridColorScheme, TmwGridColorBreak, TmwTin, TmwShapeDrawingOptions, TmwLabels,
TmwLabelCategory, TmwLabel, TmwShapefileCategories, TmwShapefileCategory, TmwCharts,
TmwChart, TmwColorScheme, TmwChartField, TmwLinePattern, TmwLineSegment,
TmwGeoProjection, TmwGlobalSettings, TmwTiles, TmwTileProviders, TmwMeasuring,
TmwShapeValidationInfo, TmwFieldStatOperations, TmwFileManager, TmwOgrDatasource, TmwOgrLayer, TmwUndoList, TmwIdentifier, TmwSelectionList, TmwDrawingRectangle, TmwGdalRasterBand, TmwHistogram, TmwGdalDataset, TmwGdalDriver, TmwGdalDriverManager, TmwFunction, TmwExpression, TmwWmsLayer, TmwGdalUtils]);

HI Charlie

Thanks for getting back to me.

So if I get the XXXXX_TLB.pas file and rename ALL the objects such as “TGridColorBreak” to “TmwGridColorBreak”, as you listed above I might be onto a winner?

Would a simple search and replace do it for me do you think?

Sorry for slow reply Jon - yes that is pretty much what I did. Take a look at the _tlb.pas I made earlier by way of example.

Hi Charlie

You refer to a _tlb.pas you made as an example… where would that be/where might I download it?

In Win10/Delphi I have removed all installs/references to mapwinGIS and now downloaded the MapWinGIS.ocx file (v

As a note I am trying to make a win32/VCL app (not x64). I am being pushed down this route due to me being limited to some 32 bit database drivers I have to use for the project.

I must thank you again for all your help.

Best regards

Sorry was assuming you had already seen that. I thought it was part of the MapWinGIS distributed code now. Can you send me an email and I will then send the file to you. My email is Charlie.Heaps “at” SEI.ORG. Email obfuscated to reduce spam.

The _tlb.pas file Charlie mentioned is indeed available in the latest MapWinGIS installers.
If you don’t have it you can get it here

If you have updated this file, could you share it with us? I will add it to the installer and then other Dephi users can use it as well.

Hi Paul

The _TLB.pas file Charlie sent over worked fine! I haven’t had to make any changes.

Now I need to find time to get my head around the API and start using it!

Once I get the hang of things I’ll update to the 5.x version.

Best regards

Thanks for the feedback.

Just ask in this forum what you want to do and we will try to assist you.

I’ll close this issue.