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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create few checkboxes in runtime

Status
Not open for further replies.

zvikorn

Programmer
Aug 6, 2003
17
0
0
US
Hello,
Im creating runtime contorl in borland builder:

TcheckBox *cBox = new TCheckBox(Form1);

I also craete its runtime 'Click' event handler:

void __fastcall TForm1::cBoxClick(TObject *Sender)
{
TCheckBox *ClickedBox = dynamic_cast<TCheckBox *>(Sender);
...
...
}

I get compilation error that cBoxClick is not a memeber of TForm1.
I remove the 'TForm1' from the declarionof the function and the compilation goes well. But then wehn I click the CheckBox, nothing happens. Can someone help me with this? Don't I need to write something like: cBox->onClick = cBoxClick(...)? I tried this as well and also got compilation error.
I would be thankful for your ideas.
zvikorn
 
You should write something like this:

TCheckBox *cBox=new TCheckBox(Form1);
cBox->Parent=this;
cBox->OnClick=Your_own_function;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top