I need to create and manage many simple published properties. I call them auto-properties if they look like that:
private
FTitle: string;
published
property Title: string read FTitle write FTitle;
Usually I create them next way:
Adding property name and type:
property Title: string
Selecting and copying property name Title
to clipboard.
Appending the line with read F
Ctrl+V write F
Ctrl+V ;
Is there any way to exclude steps 2 and 3 to add properties faster? Maybe it is possible to create some macro for this?
Since Delphi 2006 you can use LiveTemplates.
In Delphi XE for example:
propf
and hit Ctrl + J keystrokeYou can find more information on how to write your own Live Templates here:
Delphi Live Templates - http://delphi.wikia.com
Creating Live Templates - http://docwiki.embarcadero.com
I use macros for that purpose.
For example I have model with fields
private
FTitle: string;
FName: string
FAge: Integer
then I copy-paste the fields into published section and create macro
At first it seems difficult, but the skills will pay off.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With