//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "TControlTop.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: TControlTop
// Property: Controls.TWinControl.ControlCount
// Property: Controls.TWinControl.Controls
// Property: Controls.TControl.Top

// BeginCode
/*
This example uses an updown control and a group box on a 
form, with several controls contained within the group box.
When the updown control or is clicked, the controls within 
the group box are moved in the appropriate direction.
*/
void __fastcall TForm1::UpDown1Click(TObject *Sender, TUDBtnType Button)
{
  int I;
  TControl *ChildControl;

  for (I = 0; I < GroupBox1->ControlCount; I++)
  {
    ChildControl = GroupBox1->Controls[I];
    if (Button == btNext) 
      ChildControl->Top = ChildControl->Top + 15;
    else
      ChildControl->Top = ChildControl->Top - 15;
  }
}

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  const TColor colorarray[5] = {clYellow, clGreen, clBlue, clLime, clFuchsia};
  GroupBox1->Brush->Color = clRed;
  for (int i = 0; i < GroupBox1->ControlCount; i++)
	dynamic_cast<TWinControl *>(GroupBox1->Controls[i])->Brush->Color = colorarray[i];
}
// EndCode
// EndExample: TControlTop
//---------------------------------------------------------------------------

