Board index » cppbuilder » how do i know that something is insertet into my panelcomponent?

how do i know that something is insertet into my panelcomponent?


2004-01-20 06:19:50 PM
cppbuilder106
Hallo!
I created a custompanel.
Now i want to recognize if something is
inserted into it at designtime, but i have
no idea how to do it.
I tried several messages but nothing works.
Can anybody help?
Stephan
 
 

Re:how do i know that something is insertet into my panelcomponent?

"Stephan Treder" < XXXX@XXXXX.COM >wrote in message news:400cff95$ XXXX@XXXXX.COM ...
Quote
Hallo!
I created a custompanel.
Now i want to recognize if something is
inserted into it at designtime, but i have
no idea how to do it.
Handle the CM_CONTROLCHANGE message, that is one of them vcl control
messages, which is sent when another component gets inserted or removed
(Parented).
In the TMyPanel class:
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(CM_CONTROLCHANGE, TCMControlChange, CMControlChange)
END_MESSAGE_MAP(TCustomControl)
void __fastcall TMyPanel::CMControlChange(TCMControlChange& Message)
{
if( Message.Inserting )
{
//Message.Control was inserted
}
else
{
//Message.Control was removed
}
}
There is also a CM_CONTROLLISTCHANGE message that gets sent.
None of this stuff is documented, you have to read the Controls.pas file
to understand what is going on.
Todd
 

Re:how do i know that something is insertet into my panelcomponent?

Todd Brylski schrieb:
Quote
"Stephan Treder" < XXXX@XXXXX.COM >wrote in message news:400cff95$ XXXX@XXXXX.COM ...

>Hallo!
>I created a custompanel.
>Now i want to recognize if something is
>inserted into it at designtime, but i have
>no idea how to do it.



Handle the CM_CONTROLCHANGE message, that is one of them vcl control
messages, which is sent when another component gets inserted or removed
(Parented).

In the TMyPanel class:
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(CM_CONTROLCHANGE, TCMControlChange, CMControlChange)
END_MESSAGE_MAP(TCustomControl)

void __fastcall TMyPanel::CMControlChange(TCMControlChange& Message)
{
if( Message.Inserting )
{
//Message.Control was inserted
}
else
{
//Message.Control was removed
}
}

There is also a CM_CONTROLLISTCHANGE message that gets sent.
None of this stuff is documented, you have to read the Controls.pas file
to understand what is going on.

Todd


Thanks Todd.
Your code works perfectly.
And also thanks for the tip to read the Controls.pas file.
I found some other usefull stuff in it.
Stephan
 

{smallsort}