Delphi World - это проект, являющийся сборником статей и малодокументированных возможностей  по программированию в среде Delphi. Здесь вы найдёте работы по следующим категориям: delphi, delfi, borland, bds, дельфи, делфи, дэльфи, дэлфи, programming, example, программирование, исходные коды, code, исходники, source, sources, сорцы, сорсы, soft, programs, программы, and, how, delphiworld, базы данных, графика, игры, интернет, сети, компоненты, классы, мультимедиа, ос, железо, программа, интерфейс, рабочий стол, синтаксис, технологии, файловая система...
Получить список типов свойств и их описание



unit OrdForm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, TypInfo, ToolWin, ComCtrls, ExtCtrls, DdeMan, Menus, DBCtrls,
  DBTables, Db, checklst, Grids, Mask, Buttons, DBGrids, DBCGrids, FileCtrl,
  Outline, Tabnotbk, Tabs;

type
  TForm1 = class(TForm)
    Listbox1: TListBox;
    ListBox2: TListBox;
    Splitter1: TSplitter;
    procedure Listbox1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    procedure AddType (pti: PTypeInfo);
    procedure AddToList (const S: String);
  end;

  procedure ShowOrdinal (pti: PTypeInfo; sList: TStrings);
  procedure ListEnum (pti: PTypeInfo; sList: TStrings);

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Listbox1Click(Sender: TObject);
var
  pti: PTypeInfo;
begin
  pti := PTypeInfo (ListBox1.Items.Objects [
    Listbox1.ItemIndex]);
  ListBox2.Items.Clear;
  ShowOrdinal (pti, ListBox2.Items);

  // special case: TColor
  if ListBox1.Items [ListBox1.ItemIndex] = 'TColor' then
  begin
    ListBox2.Items.Add ('');
    ListBox2.Items.Add ('Values...');
    GetColorValues (AddToList);
  end;

  // special case: TCursor
  if ListBox1.Items [ListBox1.ItemIndex] = 'TCursor' then
  begin
    ListBox2.Items.Add ('');
    ListBox2.Items.Add ('Values...');
    GetCursorValues (AddToList);
  end;
end;

procedure TForm1.AddToList (const S: String);
begin
  ListBox2.Items.Add (S);
end;

// show RTTI information for ordinal types
procedure ShowOrdinal (pti: PTypeInfo; sList: TStrings);
var
  ptd: PTypeData;
begin
  // protect against misuse
  if not (pti^.Kind in [tkInteger, tkChar,
      tkEnumeration, tkSet, tkWChar]) then
    raise Exception.Create ('Invalid type information');

  // get a pointer to the TTypeData structure
  ptd := GetTypeData (pti);

  // access the TTypeInfo structure
  sList.Add ('Type Name: ' + pti^.Name);
  sList.Add ('Type Kind: ' + GetEnumName (
    TypeInfo (TTypeKind),
    Integer (pti^.Kind)));

  // access the TTypeData structure
  sList.Add ('Implement: ' + GetEnumName (
    TypeInfo (TOrdType),
    Integer (ptd^.OrdType)));

  // a set has no min and max
  if pti^.Kind <> tkSet then
  begin
    sList.Add ('Min Value: ' + IntToStr (ptd^.MinValue));
    sList.Add ('Max Value: ' + IntToStr (ptd^.MaxValue));
  end;

  // add the enumeration base type
  // and the list of the values
  if pti^.Kind = tkEnumeration then
  begin
    sList.Add ('Base Type: ' + (ptd^.BaseType)^.Name);
    sList.Add ('');
    sList.Add ('Values...');
    ListEnum (pti, sList);
  end;

  // show RRTI info about set base type
  if  pti^.Kind = tkSet then
  begin
    sList.Add ('');
    sList.Add ('Set base type information...');
    ShowOrdinal (ptd.CompType^, sList);
  end;
end;

procedure ListEnum (pti: PTypeInfo; sList: TStrings);
var
  I: Integer;
begin
  with GetTypeData(pti)^ do
    for I := MinValue to MaxValue do
      sList.Add ('  ' + IntToStr (I) + '. ' +
        GetEnumName (pti, I));
end;

procedure TForm1.AddType (pti: PTypeInfo);
begin
  ListBox1.Items.AddObject(pti^.Name, TObject (pti))
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  AddType (TypeInfo (Boolean));
  AddType (TypeInfo (Byte));
  AddType (TypeInfo (Cardinal));
  AddType (TypeInfo (Char));
  AddType (TypeInfo (Integer));
  AddType (TypeInfo (LongInt));
  AddType (TypeInfo (ShortInt));
  AddType (TypeInfo (SmallInt));
  AddType (TypeInfo (TAlign));
  AddType (TypeInfo (TAlignment));
  AddType (TypeInfo (TBatchMode));
  AddType (TypeInfo (TBevelShape));
  AddType (TypeInfo (TBevelStyle));
  AddType (TypeInfo (TBitBtnKind));
  AddType (TypeInfo (TBitmapHandleType));
  AddType (TypeInfo (TBlobStreamMode));
  AddType (TypeInfo (TBookmarkFlag));
  AddType (TypeInfo (TBorderIcon));
  AddType (TypeInfo (TBorderIcons));
  AddType (TypeInfo (TBorderStyle));
  AddType (TypeInfo (TBrushStyle));
  AddType (TypeInfo (TButtonLayout));
  AddType (TypeInfo (TButtonSet));
  AddType (TypeInfo (TButtonState));
  AddType (TypeInfo (TCanvasState));
  AddType (TypeInfo (TCanvasStates));
  AddType (TypeInfo (TCheckBoxState));
  AddType (TypeInfo (TCloseAction));
  AddType (TypeInfo (TColor));
  AddType (TypeInfo (TColorDialogOption));
  AddType (TypeInfo (TColorDialogOptions));
  AddType (TypeInfo (TColumnButtonStyle));
  AddType (TypeInfo (TColumnValue));
  AddType (TypeInfo (TColumnValues));
  AddType (TypeInfo (TComboBoxStyle));
  AddType (TypeInfo (TCommonAVI));
  AddType (TypeInfo (TComponentState));
  AddType (TypeInfo (TComponentStyle));
  AddType (TypeInfo (TConfigMode));
  AddType (TypeInfo (TConfigModes));
  AddType (TypeInfo (TConsistentAttribute));
  AddType (TypeInfo (TConsistentAttributes));
  AddType (TypeInfo (TControlState));
  AddType (TypeInfo (TControlStyle));
  AddType (TypeInfo (TCursor));
  AddType (TypeInfo (TDataAction));
  AddType (TypeInfo (TDatabaseEvent));
  AddType (TypeInfo (TDataEvent));
  AddType (TypeInfo (TDataSetState));
  AddType (TypeInfo (TDateTimeKind));
  AddType (TypeInfo (TDBCtrlGridBorder));
  AddType (TypeInfo (TDBCtrlGridKey));
  AddType (TypeInfo (TDBCtrlGridOrientation));
  AddType (TypeInfo (TDBGridColumnsState ));
  AddType (TypeInfo (TDBGridOption ));
  AddType (TypeInfo (TDBGridOptions ));
  AddType (TypeInfo (TDisplayCode ));
  AddType (TypeInfo (TDragMessage ));
  AddType (TypeInfo (TDragMode));
  AddType (TypeInfo (TDragState));
  AddType (TypeInfo (TDrawingStyle ));
  AddType (TypeInfo (TDropDownAlign ));
  AddType (TypeInfo (TDuplicates ));
  AddType (TypeInfo (TEditCharCase));
  AddType (TypeInfo (TFieldChars ));
  AddType (TypeInfo (TFieldKind ));
  AddType (TypeInfo (TFieldType ));
  AddType (TypeInfo (TFileAttr ));
  AddType (TypeInfo (TFilerFlags ));
  AddType (TypeInfo (TFileType ));
  AddType (TypeInfo (TFillMode ));
  AddType (TypeInfo (TFillStyle ));
  AddType (TypeInfo (TFilterOption ));
  AddType (TypeInfo (TFilterOptions ));
  AddType (TypeInfo (TFindItemKind ));
  AddType (TypeInfo (TFindOption ));
  AddType (TypeInfo (TFindOptions ));
  AddType (TypeInfo (TFontDialogDevice ));
  AddType (TypeInfo (TFontDialogOption ));
  AddType (TypeInfo (TFontDialogOptions ));
  AddType (TypeInfo (TFontPitch));
  AddType (TypeInfo (TFontStyle ));
  AddType (TypeInfo (TFontStyles ));
  AddType (TypeInfo (TFormBorderStyle ));
  AddType (TypeInfo (TFormState ));
  AddType (TypeInfo (TFormStyle ));
  AddType (TypeInfo (TGetMode ));
  AddType (TypeInfo (TGetResult ));
  AddType (TypeInfo (TGridDrawState ));
  AddType (TypeInfo (TGridOptions ));
  AddType (TypeInfo (TGridScrollDirection ));
  AddType (TypeInfo (THeaderSectionStyle ));
  AddType (TypeInfo (THelpContext));
  AddType (TypeInfo (THitTest ));
  AddType (TypeInfo (THitTests ));
  AddType (TypeInfo (THKInvalidKey ));
  AddType (TypeInfo (THKInvalidKeys ));
  AddType (TypeInfo (THKModifier ));
  AddType (TypeInfo (THKModifiers ));
  AddType (TypeInfo (TIconArrangement ));
  AddType (TypeInfo (TImageType ));
  AddType (TypeInfo (TImeMode ));
  AddType (TypeInfo (TIndexOptions ));
  AddType (TypeInfo (TIntfFlags ));
  AddType (TypeInfo (TItemChange ));
  AddType (TypeInfo (TItemState ));
  AddType (TypeInfo (TItemStates ));
  AddType (TypeInfo (TKeyIndex ));
  AddType (TypeInfo (TListArrangement ));
  AddType (TypeInfo (TListBoxStyle ));
  AddType (TypeInfo (TLoadResource ));
  AddType (TypeInfo (TLoadResources ));
  AddType (TypeInfo (TLocateOption ));
  AddType (TypeInfo (TLocateOptions ));
  AddType (TypeInfo (TLockType ));
  AddType (TypeInfo (TMaskCharType ));
  AddType (TypeInfo (TMaskDirectives ));
  AddType (TypeInfo (TMaskedState ));
  AddType (TypeInfo (TMenuBreak ));
  AddType (TypeInfo (TModalResult));
  AddType (TypeInfo (TMouseButton ));
  AddType (TypeInfo (TMsgDlgBtn ));
  AddType (TypeInfo (TMsgDlgButtons ));
  AddType (TypeInfo (TMsgDlgType ));
  AddType (TypeInfo (TNavButtonStyle ));
  AddType (TypeInfo (TNavGlyph ));
  AddType (TypeInfo (TNavigateBtn ));
  AddType (TypeInfo (TNodeAttachMode ));
  AddType (TypeInfo (TNodeState ));
  AddType (TypeInfo (TNumberingStyle ));
  AddType (TypeInfo (TOpenOptions ));
  AddType (TypeInfo (TOperation ));
  AddType (TypeInfo (TOperation));
  AddType (TypeInfo (TOutlineBitmap ));
  AddType (TypeInfo (TOutlineBitmaps ));
  AddType (TypeInfo (TOutlineNodeCompare ));
  AddType (TypeInfo (TOutlineOption ));
  AddType (TypeInfo (TOutlineOptions ));
  AddType (TypeInfo (TOutlineStyle ));
  AddType (TypeInfo (TOutlineType ));
  AddType (TypeInfo (TOwnerDrawState ));
  AddType (TypeInfo (TPanelBevel ));
  AddType (TypeInfo (TParamBindMode ));
  AddType (TypeInfo (TParamFlags ));
  AddType (TypeInfo (TParamType ));
  AddType (TypeInfo (TPenMode ));
  AddType (TypeInfo (TPenStyle ));
  AddType (TypeInfo (TPixelFormat ));
  AddType (TypeInfo (TPopupAlignment ));
  AddType (TypeInfo (TPosition ));
  AddType (TypeInfo (TPrintDialogOption ));
  AddType (TypeInfo (TPrintDialogOptions ));
  AddType (TypeInfo (TPrintRange ));
  AddType (TypeInfo (TPrintScale ));
  AddType (TypeInfo (TProgressStage ));
  AddType (TypeInfo (TRecNoStatus ));
  AddType (TypeInfo (TResType ));
  AddType (TypeInfo (TResType));
  AddType (TypeInfo (TResyncMode ));
  AddType (TypeInfo (TScalingFlags ));
  AddType (TypeInfo (TScrollBarInc));
  AddType (TypeInfo (TScrollBarKind));
  AddType (TypeInfo (TScrollCode));
  AddType (TypeInfo (TScrollStyle ));
  AddType (TypeInfo (TScrollStyle));
  AddType (TypeInfo (TSearchDirection ));
  AddType (TypeInfo (TSearchType ));
  AddType (TypeInfo (TSearchTypes ));
  AddType (TypeInfo (TSectionTrackState ));
  AddType (TypeInfo (TSelectDirOpt ));
  AddType (TypeInfo (TSelectDirOpts ));
  AddType (TypeInfo (TShapeType ));
  AddType (TypeInfo (TShiftState));
  AddType (TypeInfo (TShowAction ));
  AddType (TypeInfo (TSortType ));
  AddType (TypeInfo (TStaticBorderStyle ));
  AddType (TypeInfo (TStatusPanelBevel ));
  AddType (TypeInfo (TStatusPanelStyle ));
  AddType (TypeInfo (TTableType ));
  AddType (TypeInfo (TTabOrder));
  AddType (TypeInfo (TTabPosition ));
  AddType (TypeInfo (TTabStyle ));
  AddType (TypeInfo (TTextCase ));
  AddType (TypeInfo (TTextLayout));
  AddType (TypeInfo (TThreadPriority));
  AddType (TypeInfo (TTickMark));
  AddType (TypeInfo (TTickStyle));
  AddType (TypeInfo (TTileMode));
  AddType (TypeInfo (TTimerMode));
  AddType (TypeInfo (TToolButtonState));
  AddType (TypeInfo (TToolButtonStyle));
  AddType (TypeInfo (TTraceFlag));
  AddType (TypeInfo (TTraceFlags));
  AddType (TypeInfo (TTrackBarOrientation));
  AddType (TypeInfo (TTransIsolation));
  AddType (TypeInfo (TTypeKinds));
  AddType (TypeInfo (TUpdateAction));
  AddType (TypeInfo (TUpdateKind));
  AddType (TypeInfo (TUpdateMode));
  AddType (TypeInfo (TUpdateRecordTypes));
  AddType (TypeInfo (TUpdateStatus));
  AddType (TypeInfo (TValueType));
  AddType (TypeInfo (TViewStyle));
  AddType (TypeInfo (TWindowState));
  AddType (TypeInfo (WChar));
  AddType (TypeInfo (Word));
end;

end.

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

Проект Delphi World © Выпуск 2002 - 2024
Автор проекта: USU Software
Вы можете выкупить этот проект.