CnPack Forum


 
Subject: Writing property's
Bearimprint
新警察
Rank: 1


UID 41883
Digest Posts 0
Credits 8
Posts 3
点点分 8
Reading Access 10
Registered 2009-2-28
Status Offline
Post at 2009-3-30 16:50  Profile | Blog | P.M. 
Writing property's

Hi all.

First, big thank for this nice package, nice and really useful.

I have a request.
I waste much time writing property of a class.

It's any way to for example:
Write the property's

Private
  fPropOne: Cardinal;
  fPropTwo: String;


etc.

Select the property's and have a script who add, correctly, the property's like this:

TmyClass= Class
Private
  fPropOne: Cardinal;
  fPropTwo: String;
  Procedure SetPropOne(const value: cardinal);
  Function GetPopOne: cardinal;
  Procedure SetPropTwo(Const Value: String);
  Function GetPropTwo: string;
Public
  property PropOne: Cardinal read GetPropOne write SetPropOne;
  property PropTwo: String read getPropTwo write SetPropTwo;
end;

implementation


Procedure TmyClass.SetPropOne(const value: cardinal);
begin
  fPropOne:= value;
end;

Function TmyClass.GetPopOne: cardinal;
begin
  result:= fPropOne;
end;

Procedure TmyClass.SetPropTwo(Const Value: String);
begin
  fPropTwo:= value;
end;

Function TmyClass.GetPropTwo: string;
begin
  result:= fPropTwo;
end;





Well, i hope you find this usefua and, maybe, create a menu, in the BlockSelection for this task.
It would save a lot of writing
Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2009-3-30 17:16  Profile | Blog | P.M. 
I think only the two lines written in class definition and press Ctrl+Shift+C, Delphi will auto generate F* Definitions and implementations.

  property PropOne: Cardinal read GetPropOne write SetPropOne;
  property PropTwo: String read getPropTwo write SetPropTwo;

This function is powerful, ;-)
Top
Bearimprint
新警察
Rank: 1


UID 41883
Digest Posts 0
Credits 8
Posts 3
点点分 8
Reading Access 10
Registered 2009-2-28
Status Offline
Post at 2009-3-30 18:48  Profile | Blog | P.M. 
Thank for the reply ^^

But, unfortunately, this shortcut (CTRL+SHIFT+C) have work some time ago but no more since some weeks.
I have take a look if the shortcut was used by another added tools (I use Gexpert an CnPack) but, seemingly, all is ok and i don't have more idea why that don't work more properly.
(I use Delphi 7 pro).
Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2009-3-30 19:22  Profile | Blog | P.M. 
Oh, weird. Try to check the Key Mapping in Editor Options?
Or uninstall CnPack IDE Wizards and GExperts and try again?
Top
Bearimprint
新警察
Rank: 1


UID 41883
Digest Posts 0
Credits 8
Posts 3
点点分 8
Reading Access 10
Registered 2009-2-28
Status Offline
Post at 2009-3-30 19:47  Profile | Blog | P.M. 
Shame on me... :p

Well, the CTRL+SHIFT+C Works again.
Thank for the help ^^

But, after a little test, that work "only" if you write the property like:

property PropOne: Cardinal read fPropOne write SetPropOne;

And Delphi write all the rest after a CTRL+SHIFT+C

       
It may be time that i take a look at what can be done with the script, and make my own, to create properties from their statement, like i have write in my first post.

Anyway, thank again, you make my day
Top
 




All times are GMT++8, the time now is 2024-11-23 20:43

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.0.0  © 2001-2006 Comsenz Inc.
Processed in 0.016039 second(s), 9 queries , Gzip enabled

Clear Cookies - Contact Us - CnPack Website - Archiver - WAP