Subject | Re: [IBO] TIB_GridInplaceEdit |
---|---|
Author | Geoff Worboys |
Post date | 2001-03-03T02:01:35Z |
> This was ok for the compiler, but when I do somethingDont use 'as' unless you know the type will match at runtime. 'as'
> in the OnEditButtonClick-Event of my IP_Grid, I get an
> 'invalid typcast'-error.
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
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.
HTH
Geoff Worboys
Telesis Computing