Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Buttons... help!!!

Status
Not open for further replies.

LastCyborg

Programmer
Feb 7, 2003
256
MX
I have created some dynamic buttons, but I want that every button do differents things, so my doubt is what can I do to tell every button what to do?

For example:

#include <vcl.h>
#pragma hdrstop
#include &quot;Unit1.h&quot;
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
TButton *Button[10];
int i=0;
//----------------------------------------------------------__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//----------------------------------------------------------void __fastcall TForm1::Button1Click(TObject *Sender)
{
Button = new TButton (this);
Button->Caption = AnsiString(&quot;NewButton&quot; + IntToStr(i));
Button->Top = i*35;
Button->Parent = Form1;
i++;
}
//----------------------------------------------------------void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
delete Button;
}


I want that if I pressed the &quot;NewButton 3&quot; make a change a color, if &quot;NewButton4&quot; is pressed, change the caption of another button etc.

 
I solve my problem, so if u have a question about it just let me know
ok?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top