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

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

•  TDictionary Custom Sort  6 832

•  Fast Watermark Sources  6 614

•  3D Designer  9 578

•  Sik Screen Capture  6 957

•  Patch Maker  7 400

•  Айболит (remote control)  7 347

•  ListBox Drag & Drop  6 206

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

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

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

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

•  Canvas Drawing  6 038

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

•  Поворот изображения  5 281

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

•  Paint on Shape  3 024

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

•  Головоломка Paletto  3 157

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

•  Пазл Numbrix  2 637

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

•  Игра HIP  2 367

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

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

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

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

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

•  HEX View  2 746

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

 
скрыть

  Форум  

Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



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





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.

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