Поддержка / 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  
 

Получить доступ к элементам TRadioGroup

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

{ 
  Die Eigenschaft Controls fuhrt alle untergeordneten Komponenten eines Steuerelements 
  (Hier z.B TRadioGroup) auf. 
  Controls ist hilfreich, wenn auf die untergeordneten Steuerelemente mit einer Zahl und 
  nicht mit ihrem Namen Bezug genommen werden soll. 
  So kann Controls beispielsweise verwendet werden, um in einer TRadioGroup Eigenschaften 
  der RadioButtons zu manipulieren (Hints anzeigen, verstecken,...) 
}

 { 
  The property Controls lists all child controls of a Control.(Here a TRadioGroup) 
  Controls is an array of all the child controls. 
  The Controls property is convenient for referring to the children of a control 
  by number rather than name. 
  For example, Controls may be used to change properties of the Radiobuttons in a 
  TRadioGroup (showing hints, hiding items,...) 
}


 {1. *******************************************************}
 // Deactivates/activates a specified item of a TRadioGroup 
// Deaktiviert/aktiviert in einer TRadioGroup ein bestimmtes Item 

procedure RGB_EnableItem(RadioGroup: TRadioGroup; ItemIndex: Byte; bEnabled: Boolean);
 begin
   RadioGroup.Controls[ItemIndex].Enabled := bEnabled;
 end;

 // Example: Deactivates the 2. Item  (Index starts at 0) 
// Beispiel: 2. Item deaktivieren (Index beginnt bei 0) 

procedure TForm1.Button1Click(Sender: TObject);
 begin
   RGB_EnableItem(RadioGroup1, 1, False);
 end;


 {2. *******************************************************}
 // Hides/Shows a specified item of a TRadioGroup 
// Versteckt oder zeigt ein bestimmtes Item in einer TRadioGroup an. 
procedure RGB_ShowItem(RadioGroup: TRadioGroup; ItemIndex: Byte; bVisible: Boolean);
 begin
   RadioGroup.Controls[ItemIndex].Visible := bVisible;
 end;

 // Example: Hides the 2. Item  (Index starts at 0) 
// Beispiel: 2. Item verstecken (Index beginnt bei 0) 
procedure TForm1.Button2Click(Sender: TObject);
 begin
   RGB_ShowItem(RadioGroup1, 1, False);
 end;


 {3. *******************************************************}
 // Show Hints for TRadioGroup items 
// Hints fur die Items in der TRadioGroup anzeigen 
procedure TForm1.Button3Click(Sender: TObject);
 var
   i: Byte;
 begin
   for i := 0 to RadioGroup1.ControlCount - 1 do
   begin
     RadioGroup1.Controls[i].ShowHint := True;
     RadioGroup1.Controls[i].Hint := (Radiogroup1.Controls[i] as TRadiobutton).Caption;
   end;
 end;

 {4. *******************************************************}
 // Focus a specified Radiobutton in a TRadioGroup 
// Ein bestimmter Radiobutton einer TRadioGroup fokussieren 
procedure RGB_FocusItem(RadioGroup: TRadioGroup; ItemIndex: Byte);
 var
   RadiogroupClick: TNotifyEvent;
 begin
   if ItemIndex >= 0 then
   begin
     RadioGroup.OnClick := nil;
     (RadioGroup.Controls[1] as TRadiobutton).SetFocus;
     RadioGroup.OnClick := RadiogroupClick;
   end;
 end;

 // Example: Focus the 2. Radiobutton 
// Beispiel: Den 2. Radiobutton fokussieren 
procedure TForm1.Button4Click(Sender: TObject);
 begin
   RGB_FocusItem(RadioGroup1, 1);
 end;



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



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