Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 4 of 4

How do you read from a FindResults type in delphi?

This is a discussion on How do you read from a FindResults type in delphi? within the MapPoint Desktop Discussion forums, part of the Map Forums category; oResult : FindResults; FMap : _map; begin FMap := Application1.ActiveMap as _Map; Loc := FMap.GetLocation(X, Y,1) as Location; Loc.GoTo_; oResult ...

  1. #1
    matt1168 is offline Junior Member Yellow Belt
    Join Date
    Jul 2003
    Posts
    14

    How do you read from a FindResults type in delphi?

    oResult : FindResults;
    FMap : _map;
    begin
    FMap := Application1.ActiveMap as _Map;
    Loc := FMap.GetLocation(X, Y,1) as Location;
    Loc.GoTo_;
    oResult := FMap.ObjectsFromPoint(FMap.LocationToX(Loc),FMap.L ocationToY(Loc)) as FindResults;

    if i use this code to search with i get 5 results. but i cannot read any of the results. Every thime i try i get an access violation. I have tried several different code samples from this site and i allways get an access violation any ideas?

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Hello,

    Try the following:

    procedure TForm1.Button1Click(Sender: TObject);
    var
    vFindResult : FindResults;
    vStreetAddress : StreetAddress;
    vResult : string;
    i : integer;
    iOle : OleVariant
    begin
    for i := 1 to vFindResult.Count do
    begin
    iOle := i;

    // To access name result:
    vResult := (vFindResult[iOle] as Location).Name;

    // Or to access streetaddres result:
    vStreetAddress := (vFindResult[iOle] as Location).StreetAddress;
    if Assigned(vStreetAddress) then
    begin
    ...
    end;
    end;
    end;

    Greetings, Jack.

  3. #3
    matt1168 is offline Junior Member Yellow Belt
    Join Date
    Jul 2003
    Posts
    14
    Thanks that works great

  4. #4
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    How do you read from a FindResults type in delphi?

    That works fine if the result object is a Location, but what if it happens to be a PushPin ?
    Then casting it to a Location would give strange results, no ?
    So how can you tell want the result object type is ?

    Rene

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. how to read .shp files
    By shaileshganatra in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-10-2008, 08:46 PM
  2. [HELP]: Problem with C# and FindResults
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 08-27-2004, 03:51 AM
  3. set note read-only
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 08-05-2003, 10:50 AM
  4. OS Grid References - FindResults
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 10-14-2002, 04:20 AM
  5. I have read you can zoom the map to any lat/long f....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-19-2001, 04:50 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25