Недавно добавленные исходники

•  DeLiKaTeS Tetris (Тетрис)  4 450

•  TDictionary Custom Sort  6 483

•  Fast Watermark Sources  6 281

•  3D Designer  9 224

•  Sik Screen Capture  6 615

•  Patch Maker  6 994

•  Айболит (remote control)  6 998

•  ListBox Drag & Drop  5 867

•  Доска для игры Реверси  97 059

•  Графические эффекты  7 198

•  Рисование по маске  6 501

•  Перетаскивание изображений  5 365

•  Canvas Drawing  5 741

•  Рисование Луны  5 454

•  Поворот изображения  4 981

•  Рисование стержней  3 535

•  Paint on Shape  2 803

•  Генератор кроссвордов  3 669

•  Головоломка Paletto  2 959

•  Теорема Монжа об окружностях  3 763

•  Пазл Numbrix  2 481

•  Заборы и коммивояжеры  3 166

•  Игра HIP  2 132

•  Игра Go (Го)  2 066

•  Симулятор лифта  2 438

•  Программа укладки плитки  2 113

•  Генератор лабиринта  2 584

•  Проверка числового ввода  2 264

•  HEX View  2 591

•  Физический маятник  2 202

 
скрыть

Определить и выставить значение текстового свойства





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.

Загрузить весь проект