вот пример выставления строкового свойства но учти! как сказал Alexeis выставляемое свойство должно быть published
| Код | unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Edit1: TEdit; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public procedure SetStringProperty(ABindingControl: TControl; ABindingProperty: string; AValue: string); end;
var Form1: TForm1;
implementation
uses TypInfo;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject); begin SetStringProperty(Edit1, 'Text', 'значение'); end;
procedure TForm1.SetStringProperty(ABindingControl: TControl; ABindingProperty: string; AValue: string); var pProperty: PPropInfo; begin pProperty := GetPropInfo(ABindingControl, ABindingProperty); if pProperty <> nil then begin if pProperty.PropType^.Kind in [tkString, tkLString, tkWString] then SetStrProp(ABindingControl, ABindingProperty, AValue); end; end;
end.
|
|