Subject Re: [IBO] TIB_GridInplaceEdit
Author guido.klapperich@t-online.de
Now it works, but when I click on the date-field, first the code in the
OnEditButtonClick-Event is executed and then opens the calendar. Is this the
right behaviour ? I thought, when I click on a date-field, the
OnEditButtonClick-Event will be ignored. By the way, IB_Grid does the same.

Guido.

Geoff Worboys wrote:

> > This was ok for the compiler, but when I do something
> > in the OnEditButtonClick-Event of my IP_Grid, I get an
> > 'invalid typcast'-error.
>
> 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
>
> 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
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/