[Lazarus] Delphi incompatibility - hard cast

Alejandro Gonzalo parkingspace26 at yahoo.com
Fri Jan 31 04:48:28 CET 2014


OK, how about a compiler switch (that can be turned on or off) that SEARCHES for the property (or event if defined in code and not by the Object Inspector)?  It shouldn't be so difficult to deal with Sender (or components in a loop) where the exact Type is not known in advance, just the presence of a specific property or Event.  If the switch can be turned Off again after the routine, the impact on performance shouldn't be a concern.  Greater flexibility and ease of use, especially for newbies (RTTI is difficult and poorly documented) is needed if freepascal/Lazarus is to become universally adopted. 

Can there please be a discussion on this?  Thanks!

A. G.



On Thursday, January 30, 2014 3:58 PM, Alejandro Gonzalo <parkingspace26 at yahoo.com> wrote:
 
OK, how about a compiler switch (that can be turned on or off) that SEARCHES for the property (or event if defined in code and not by the Object Inspector)?  It shouldn't be so difficult to deal with Sender (or components in a loop) where the exact Type is not known in advance, just the presence of a specific property or Event.  If the switch can be turned Off again after the routine, the impact on performance shouldn't be a concern.  Greater flexibility and ease of use, especially for newbies (RTTI is difficult and poorly documented) is needed if freepascal/Lazarus is to become universally adopted.  

Can there please be a discussion on this?  Thanks!

A. G.





On Friday, January 17, 2014 6:22 PM, Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:
 
Alejandro Gonzalo schrieb:
> In Delphi this will work even if the Sender is not a TdbGrid, as long as 
> it has a DataSource property:

It only *happens* to work for you in Delphi.


>   TdbGrid(Sender).datasource:=myDataSource;

This hack requires that Sender has a DataSource property in *exactly* 
the same place where it sits in
 TdbGrid. That's very unlikely for any 
other class.

DoDi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140130/646e64ee/attachment-0003.html>


More information about the Lazarus mailing list