var
rc: Variant;
ftrs : Variant;
// Used for storing collection of features
sitename:string;
i:integer;
searchResultsList.Clear;
rc := CreateOleObject('MapX.Rectangle.4');
rc.Set(X1, Y1, X2, Y2);
ftrs := EditLayer.SearchWithinRectangle(rc, miSearchTypeEntirelyWithin);
MessageDlg(inttostr(ftrs.Count), mtInformation, [mbOK], 0);
for i := 1 to ftrs.Countdo
begin
infoFeature := Ftrs.Item(i);
EditLayer.KeyField:='site';
searchResultsList.Items.Add(infoFeature.KeyValue);
end;