View Single Post

  #5 (permalink)  
Old 04-30-2004
Anonymous Anonymous is offline
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Hello John

You know when you can't see the wood for the trees, well I've just had that experience.

You're code pushed me in the right direction.

I now realise that selecting a shape using the mouse pointer is exacly the same as issuing the .SELECT command. So once it's selected, the .NAME command can be issued. It's so simple once the penny drops.

So for anyone out there using Delphi and wanting to find the name of a shape when selecting with a mouse, here's a procedure that will accomplish it.

Code:
procedure TMainForm.MappointSelectionChange(Sender: TObject; const pNewSelection, pOldSelection: IDispatch); 
var 
    oShape: Shape; 
begin 
    If assigned(pNewSelection) Then 
      Begin 
        pNewSelection.QueryInterface(IID_Shape, oShape); 
        If assigned(oShape) Then Showmessage('Shape Name = ' + oShape.Name); 
      End; 
end;
Thanks ever so much for the push in the right direction.

Regards
Les
Reply With Quote