StdCtrlsProp (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example demonstrates the use of some properties available for TButton, TComboBox, TEdit, TLabel and TMemo objects.

Code

__fastcall TMainForm::TMainForm(TComponent* Owner) : TForm(Owner)
{
  cmbGender->TextHint = "Select your gender";
  edAge->Alignment = taCenter;
  edAge->NumbersOnly = true;
  edAge->MaxLength = 2;
  btProcess->Enabled = false;
  Memo1->CharCase = ecUpperCase;
  lblGender->GlowSize = 5;
  edInsAge->SetSelText("Age:");
  edInsAge->Enabled = false;
}

void __fastcall TMainForm::btProcessClick(TObject *Sender)
{
  Memo1->Lines->Clear();
  if (SecondaryForm->ShowModal() == mrOk)
  {
	Memo1->Lines->Add("Your information has been processed.");
  }
  if (cmbGender->ItemIndex == 0)
  {
	Memo1->Lines->Add("Male");
  }
  else
   {
	Memo1->Lines->Add("Female");
   }
  Memo1->Lines->Add(edAge->Text);
}

void __fastcall TMainForm::edAgeChange(TObject *Sender)
{
  edAge->Color = clHotLight;
  btProcess->Enabled = true;
}

Uses