Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Tag
Mon, Feb 11 2013 10:55 AMPermanent Link

Matthew Jones

I know this is quite trivial, but is there a way to make the event code for
OnChange etc pass the TComponent instead of TObject? Only it would make accessing
the Tag so much easier. That said, since it will be a TComponent, the hard cast to
one isn't so bad.

Can I suggest that the (Sender as TComponent) syntax be supported as well as
TComponent(Sender)? Sure, it won't actually be able to do the check, but it would
be nice to be able to copy and paste code and use the better syntax.

/Matthew Jones/
Thu, Feb 14 2013 11:44 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I know this is quite trivial, but is there a way to make the event code
for OnChange etc pass the TComponent instead of TObject? >>

I'll have to review whether this would break any existing code or not.  It
shouldn't, but I'd have to check.

<< Can I suggest that the (Sender as TComponent) syntax be supported as well
as TComponent(Sender)? Sure, it won't actually be able to do the check, but
it would be nice to be able to copy and paste code and use the better
syntax. >>

The problem with "as" is that you're trading a compiler check for a runtime
error, and not a runtime error that is easily expressed.  You'll end up
getting weird errors about properties not existing or being NULL, and it
will not be readily apparent as to the source of the problem.  IOW, such a
change equals more support calls for us.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Feb 14 2013 2:45 PMPermanent Link

Matthew Jones

>  IOW, such a
> change equals more support calls for us.

I guess that is a fair cost. I wouldn't expect it to do anything different, but it
wouldn't be obvious.

/Matthew Jones/
Image