Alrighty then. I remember now, must have fried a couple of neurons getting
up too early this morning or something. :)
Thanks for the responses!
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Max Nilson
> Sent: Thursday, November 02, 2000 10:01
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Today's Mental block
>
>
> Nahum Wild asked:
>
> > Currently I'm just forcibly casting at runtime the objects to
> > the interface
> > and trapping the exception generated if it don't work.
> >
> > for i := fUndoList.Count-1 do begin
> > try
> > (fMyList[i] as ICommandInterface).Prune;
> > except
> > on E: EIntfCastError do begin
> > // do nothing
> > end;
> > end;
> > end;
> >
> > This is pretty yuck and want to do it a better/nicer way. Does
> > anybody know
> > what I'm taking about and/or can help??
>
> Use Supports, as in
>
> var
> Command: ICommandInterface;
> I: Integer;
> begin
> for i := fUndoList.Count-1 do
> if Supports(fMyList[I], ICommandInterface, Command) then
> Command.Prune
>
> Declared in SysUtils I think.
>
> Cheers, Max.
>
> ------------------------------------------------------------------
> ---------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"