unit StrForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
ButtonGet: TButton;
EditProperty: TEdit;
Label1: TLabel;
Bevel1: TBevel;
ButtonTrial: TButton;
Label2: TLabel;
LabelResult: TLabel;
ButtonSet: TButton;
Label3: TLabel;
EditValue: TEdit;
procedure ButtonGetClick(Sender: TObject);
procedure ButtonSetClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
uses
TypInfo;
procedure TForm1.ButtonGetClick(Sender: TObject);
var
PropInfo: PPropInfo;
begin
if not Assigned (ButtonTrial) then
ShowMessage ('The button has been renamed')
else
begin
PropInfo := GetPropInfo (
ButtonTrial.ClassInfo, EditProperty.Text);
if PropInfo <> nil then
if PropInfo^.PropType^.Kind =
tkLString then
LabelResult.Caption :=
GetStrProp (ButtonTrial, PropInfo)
else
ShowMessage ('Not a string property')
else
ShowMessage ('Property doesn''t exist');
end;
end;
procedure TForm1.ButtonSetClick(Sender: TObject);
var
PropInfo: PPropInfo;
begin
if not Assigned (ButtonTrial) then
ShowMessage ('The button has been renamed')
else
begin
PropInfo := GetPropInfo (
ButtonTrial.ClassInfo, EditProperty.Text);
if PropInfo <> nil then
if PropInfo^.PropType^.Kind =
tkLString then
SetStrProp (ButtonTrial, PropInfo, EditValue.Text)
else
ShowMessage ('Not a string property')
else
ShowMessage ('Property doesn''t exist');
end;
end;
end.
|