Guest:
Register
|
Login
|
Member List
|
Search
|
Statistics
|
FAQ
Language
----------
Simplifed Chinese
Traditional Chinese
English
CnPack Forum
»
CnVCL 组件包
» [cnpack\cnvcl\Examples\AutoOption的TStringlist]Help
‹‹ Last Thread
|
Next Thread ››
Poll
Trade
Reward
Activity
Printable Version
|
Email to Friend
|
Subscription
|
Favorites
Subject: [cnpack\cnvcl\Examples\AutoOption的TStringlist]Help
f00l
(色舞天姬)
普通灌水员
UID 40612
Digest Posts 0
Credits 57
Posts 24
点点分 57
Reading Access 10
Registered 2008-6-30
Status Offline
#1
Post at 2009-6-3 14:54
Profile
|
Blog
|
P.M.
[cnpack\cnvcl\Examples\AutoOption的TStringlist]Help
cnpack\cnvcl\Examples\AutoOption的Demo。
在MyClass1里加了属性
private
Fsl : TStringList;
procedure Setsl(Asl: TStringList);
published
constructor Create();
property sl: TStringList read Fsl write Setsl;
constructor TMyClass1.Create;
begin
Fsl := TStringList.Create;
Fsl.Add('a');
Fsl.Add('b');
end;
procedure TMyClass1.Setsl(Asl: TStringList);
begin
ShowMessage('Setting');
end;
我是SBT.T为啥Apply以后Setls不起作用而是直接更改sl呢0.0
是不是小生犯了原则 Sex 问题0.0
Passion
(LiuXiao)
管理员
UID 359
Digest Posts
19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
#2
Post at 2009-6-3 15:26
Profile
|
Blog
|
P.M.
估计代码里头是直接处理的sl.Add或sl.Text :=,用这方式赋值的。
这样赋值是不会调用SetSl的,而只会直接使用Fsl这对象来进行操作。
Passion
(LiuXiao)
管理员
UID 359
Digest Posts
19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
#3
Post at 2009-6-3 15:29
Profile
|
Blog
|
P.M.
测试代码,点击btnSet时,不会触发Set事件:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
btnSet: TButton;
btnShow: TButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure btnSetClick(Sender: TObject);
procedure btnShowClick(Sender: TObject);
private
FList: TStringList;
procedure SetList(const Value: TStringList);
{ Private declarations }
public
{ Public declarations }
property List: TStringList read FList write SetList;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
FList := TStringList.Create;
List.Add('aaa');
end;
procedure TForm1.SetList(const Value: TStringList);
begin
ShowMessage('Set 了');
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FList.Free;
end;
procedure TForm1.btnSetClick(Sender: TObject);
begin
List.Text := 'xxxxxxx';
List.Add('bbbbbb');
end;
procedure TForm1.btnShowClick(Sender: TObject);
begin
ShowMessage(List.Text);
end;
end.
Poll
Trade
Reward
Activity
CnPack Forum
CnPack English Forum
> CnWizards IDE Wizards
> CVSTracNT
> Announcements & Others
All times are GMT++8, the time now is 2024-11-22 12:12
Powered by
Discuz!
5.0.0
© 2001-2006
Comsenz Inc.
Processed in 0.008130 second(s), 9 queries , Gzip enabled
TOP
Clear Cookies
-
Contact Us
-
CnPack Website
-
Archiver
-
WAP
Member's CP Home
Edit Profile
Credits Transaction
Public User Groups
Buddy List
Main
Page Views
User Agents
Posts History
Top Forums
Top Threads
Post Ranking
Credit Ranking
Online Time
Team
Moderation Stats