Gene Buckle
2008-07-23 16:17:51 UTC
I've got a TLabel on a custom control that I need to be able to have
it generate the OnClick event for the parent that it's living on.
Right now I've got it set up like this:
CustomControl->OnClick = ClickHandler;
CustomControl->Label->OnClick = ClickHandler;
Now what ends up happening is that if you click the label instead of the
surrounding panel, the Label OnClick event is fired. Unfortunately
this makes the Sender a TLabel and not the CustomControl that it must be.
How can I manipulate it in such a way that if the label is clicked, it
will pass the correct Sender?
I've tried:
x = ((TLabel*)Sender)->Tag;
if (x == 2112) {
// we're coming from the label on the TFunctionPanel...
workPanel = ((TFunctionPanel*)Sender)->Parent;
}
However, the compiler errors with "Cannot Convert 'TWinControl* const' to
'TFunctionPanel *'
Help! :)
g.
it generate the OnClick event for the parent that it's living on.
Right now I've got it set up like this:
CustomControl->OnClick = ClickHandler;
CustomControl->Label->OnClick = ClickHandler;
Now what ends up happening is that if you click the label instead of the
surrounding panel, the Label OnClick event is fired. Unfortunately
this makes the Sender a TLabel and not the CustomControl that it must be.
How can I manipulate it in such a way that if the label is clicked, it
will pass the correct Sender?
I've tried:
x = ((TLabel*)Sender)->Tag;
if (x == 2112) {
// we're coming from the label on the TFunctionPanel...
workPanel = ((TFunctionPanel*)Sender)->Parent;
}
However, the compiler errors with "Cannot Convert 'TWinControl* const' to
'TFunctionPanel *'
Help! :)
g.
--
Proud owner of F-15C 80-0007
http://www.f15sim.com - The only one of its kind.
Proud owner of F-15C 80-0007
http://www.f15sim.com - The only one of its kind.