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

•  DeLiKaTeS Tetris (Тетрис)  3 927

•  TDictionary Custom Sort  6 031

•  Fast Watermark Sources  5 821

•  3D Designer  8 641

•  Sik Screen Capture  6 153

•  Patch Maker  6 594

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

•  ListBox Drag & Drop  5 442

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

•  Графические эффекты  6 796

•  Рисование по маске  5 967

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

•  Canvas Drawing  5 343

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

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

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

•  Paint on Shape  2 507

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

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

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

•  Пазл Numbrix  2 295

•  Заборы и коммивояжеры  2 985

•  Игра HIP  1 945

•  Игра Go (Го)  1 858

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

•  Программа укладки плитки  1 931

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

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

•  HEX View  2 376

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

 
скрыть

  Форум  

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-2025 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

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