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

•  Animation Loaders  646

•  DeLiKaTeS Tetris (Тетрис)  5 658

•  TDictionary Custom Sort  7 620

•  Fast Watermark Sources  7 309

•  3D Designer  10 507

•  Sik Screen Capture  7 828

•  Patch Maker  8 056

•  Айболит (remote control)  8 113

•  ListBox Drag & Drop  6 920

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

•  Графические эффекты  8 179

•  Рисование по маске  7 576

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

•  Canvas Drawing  6 545

•  Рисование Луны  6 473

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

•  Рисование стержней  4 575

•  Paint on Shape  3 280

•  Генератор кроссвордов  4 265

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

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

•  Пазл Numbrix  2 744

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

•  Игра HIP  2 450

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

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

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

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

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

•  HEX View  2 903

 
скрыть

  Форум  

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

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



Delphi Sources

Вывести информацию о возможных значениях свойств



Автор: Xavier Pacheco

unit MainFrm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Grids;

type
  TMainForm = class(TForm)
    lbSamps: TListBox;
    memInfo: TMemo;
    procedure FormCreate(Sender: TObject);
    procedure lbSampsClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  MainForm: TMainForm;

implementation
uses TypInfo, Buttons;

{$R *.DFM}

procedure TMainForm.FormCreate(Sender: TObject);
begin
  // Add some example enumerated types
  with lbSamps.Items do
  begin
    AddObject('TBorderIcons', TypeInfo(TBorderIcons));
    AddObject('TGridOptions', TypeInfo(TGridOptions));
  end;
end;

procedure GetTypeInfoForOrdinal(AOrdTypeInfo: PTypeInfo; AStrings: TStrings);
var
  //  OrdTypeInfo: PTypeInfo;
  OrdTypeData: PTypeData;

  TypeNameStr: string;
  TypeKindStr: string;
  MinVal, MaxVal: Integer;
  i: integer;
begin

  // Get the TTypeData pointer
  OrdTypeData := GetTypeData(AOrdTypeInfo);

  // Get the type name string
  TypeNameStr := AOrdTypeInfo.Name;
  // Get the type kind string
  TypeKindStr := GetEnumName(TypeInfo(TTypeKind), Integer(AOrdTypeInfo^.Kind));

  // Get the minimum and maximum values for the type
  MinVal := OrdTypeData^.MinValue;
  MaxVal := OrdTypeData^.MaxValue;

  // Add the information to the memo
  with AStrings do
  begin
    Add('Type Name: ' + TypeNameStr);
    Add('Type Kind: ' + TypeKindStr);

    // Call this function recursively to show the enumeration
    // values for this set type.
    if AOrdTypeInfo^.Kind = tkSet then
    begin
      Add('==========');
      Add('');
      GetTypeInfoForOrdinal(OrdTypeData^.CompType^, AStrings);
    end;

    // Show the values and names of the enumerated types belonging to the
    // set.
    if AOrdTypeInfo^.Kind = tkEnumeration then
    begin
      Add('Min Val: ' + IntToStr(MinVal));
      Add('Max Val: ' + IntToStr(MaxVal));

      for i := MinVal to MaxVal do
        Add(Format('  Value: %d   Name: %s', [i, GetEnumName(AOrdTypeInfo,
          i)]));
    end;
  end;

end;

procedure TMainForm.lbSampsClick(Sender: TObject);
begin
  memInfo.Lines.Clear;
  with lbSamps do
    GetTypeInfoForOrdinal(PTypeInfo(Items.Objects[ItemIndex]), memInfo.Lines);
end;
end.







Copyright © 2004-2026 "Delphi Sources" by «SiteAnalyzer». Delphi World FAQ

Группа ВКонтакте