PDA

View Full Version : How to use MouseEvents with Delphi in an TOleContainer ?



rbarthels
01-07-2003, 08:12 AM
I am using MP2002 with Delphi and the TOleContainer as it is described by Jack Melger
(http://www.mp2kmag.com/articles.asp?ArticleID=65&key=delphi.example).

The code is:

procedure TForm1.FormActivate(Sender: TObject);
var vGuid : TGuid;
begin
OleContainer.CreateObject('MapPoint.Map.EU.9', False);
OleContainer.DoVerb(1);
OleContainer.OleObjectInterface.GetUserClassID(vGu id);
FMap := IDispatch(OleContainer.OleObject) as _Map;
end

Now I want to use the the MouseDown-Event to get a coordinate for my application.

How do I do that ?

When I use MP2002 as a separate application and put TMap on the form this is easy. But with TOleContainer ?

Regards
Rainer Barthels

Anonymous
01-12-2003, 03:05 AM
Hello Rainer,

Apart from the FMap in the OleContainer you should add a TMap component to your form. Then you have to use the ConnectTo command from Delphi to connect the FMap to the TMap component. Now you can use all events of the TMap component in your application.

Good luck, Jack.

rbarthels
01-14-2003, 01:50 AM
Thank you very much. That works.