Subject Re: [IBO] TIB_GridInplaceEdit
Author guido.klapperich@t-online.de
> Dont use 'as' unless you know the type will match at runtime. 'as'
> does a true runtime check and will give the error that you saw if it
> does not match. To perform a "hack" such as yours (no offence but I
> think that is the correct descriptive term for this type of activity
> :-) force the compiler to use the type defined...
>
> if Assigned( InPlaceEditor ) and
> (TIP_GridInplaceEdit(InPlaceEditor).EditStyle = esDate) then
>

Interesting, I thought (Object as class) and class(object) are the same. By
the way, the code I posted, was the original code from Jason.

>
> This is much less safe since it forces the interpretation whether
> compatible or not. For TIB_Grid it is redundant, but the preferable
> code for your specific case would probably be...
>
> if Assigned( InPlaceEditor ) and
> (InplaceEditor is TIB_GridInplaceEdit) and
> (TIP_GridInplaceEdit(InPlaceEditor).EditStyle = esDate) then
>
> So that you are sure you are dealing with the base class from which
> TIP_* is derived.

I'll try it.

Thanks.

Guido.