Поддержка / Donate
 

WebMoney

Яндекс.Деньги

SMS.Копилка
Деньги@Mail.ru
Rupay
E-gold
PayPal

 

Благодарю за поддержку!

Лента RSS - Новости сайта Новости сайта
Лента RSS - Новости форума Новости форума
Добавить в закладки и поделиться Bookmark and Share

 

Архив исходников

 


Automatic translation

 
English German French
Italian Spanish Portuguese
Greece Japan Chinese
  Korean  

  

 

  Форум  

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

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



Google  
 

Отобразить все свойства и события компонента

Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch

uses
   TypInfo;

 procedure ListComponentProperties(Component: TComponent; Strings: TStrings);
 var
   Count, Size, I: Integer;
   List: PPropList;
   PropInfo: PPropInfo;
   PropOrEvent, PropValue: string;
 begin
   Count := GetPropList(Component.ClassInfo, tkAny, nil);
   Size  := Count * SizeOf(Pointer);
   GetMem(List, Size);
   try
     Count := GetPropList(Component.ClassInfo, tkAny, List);
     for I := 0 to Count - 1 do
     begin
       PropInfo := List^[I];
       if PropInfo^.PropType^.Kind in tkMethods then
         PropOrEvent := 'Event'
       else
         PropOrEvent := 'Property';
       PropValue := VarToStr(GetPropValue(Component, PropInfo^.Name));
       Strings.Add(Format('[%s] %s: %s = %s', [PropOrEvent, PropInfo^.Name,
         PropInfo^.PropType^.Name, PropValue]));
     end;
   finally
     FreeMem(List);
   end;
 end;

 // Example: List all Properties/Events from Button1 in a TListBox 

procedure TForm1.Button1Click(Sender: TObject);
 begin
   ListComponentProperties(Button1, ListBox1.Items);
 end;



Источник - Проект "Delphi World" © Выпуск 2002 - 2004
Автор проекта: Акулов Николай



   Rambler's Top100             Яндекс цитирования