home *** CD-ROM | disk | FTP | other *** search
/ Delphi 4 Bible / Delphi_4_Bible_Tom_Swan_IDG_Books_1998.iso / source / CONTCOMP / MAIN.PAS < prev   
Pascal/Delphi Source File  |  1998-04-04  |  1KB  |  68 lines

  1. unit Main;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, SysUtils, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons;
  8.  
  9. type
  10.   TMainForm = class(TForm)
  11.     ScrollBox1: TScrollBox;
  12.     Label1: TLabel;
  13.     RadioButton1: TRadioButton;
  14.     RadioButton2: TRadioButton;
  15.     RadioButton3: TRadioButton;
  16.     Button1: TButton;
  17.     Button2: TButton;
  18.     ScrollBoxComponents: TListBox;
  19.     ScrollBoxControls: TListBox;
  20.     FormComponents: TListBox;
  21.     FormControls: TListBox;
  22.     Label2: TLabel;
  23.     Label3: TLabel;
  24.     Label4: TLabel;
  25.     Label5: TLabel;
  26.     CloseBitBtn: TBitBtn;
  27.     procedure FormCreate(Sender: TObject);
  28.   private
  29.     { Private declarations }
  30.   public
  31.     { Public declarations }
  32.   end;
  33.  
  34. var
  35.   MainForm: TMainForm;
  36.  
  37. implementation
  38.  
  39. {$R *.DFM}
  40.  
  41. procedure ListControls(ListBox: TListBox; Control: TWinControl);
  42. var
  43.   I: Integer;
  44. begin
  45.   with Control do
  46.   for I := 0 to ControlCount - 1 do
  47.     ListBox.Items.Add(Controls[I].Name);
  48. end;
  49.  
  50. procedure ListComponents(ListBox: TListBox; Component: TComponent);
  51. var
  52.   I: Integer;
  53. begin
  54.   with Component do
  55.   for I := 0 to ComponentCount - 1 do
  56.     ListBox.Items.Add(Components[I].Name);
  57. end;
  58.  
  59. procedure TMainForm.FormCreate(Sender: TObject);
  60. begin
  61.   ListControls(ScrollBoxControls, ScrollBox1);
  62.   ListComponents(ScrollBoxComponents, ScrollBox1);
  63.   ListControls(FormControls, MainForm);
  64.   ListComponents(FormComponents, MainForm);
  65. end;
  66.  
  67. end.
  68.