 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jilaing Guest
|
Posted: Mon Sep 22, 2003 9:29 am Post subject: How can I catch TWMLButtonDown Message in Dispatch method? |
|
|
Hi
I derived a component from TCustomPanel and write Dispatch method for it to catch TWMLButtonDown Message as follow
void __fastcall TMyComponent::Dispatch(void *Message)
{
switch(((PMessage)Message)->Msg)
{
MESSAGE_HANDLER(WM_LBUTTONDOWN, Messages::TWMLButtonDown,
WMLButtonDown)
default:
TCustomPanel::Dispatch(Message);
break;
}
}
MESSAGE void __fastcall TMyComponent::WMLButtonDown
(Messages::TWMLButtonDown &Message)
{
ShowMessage("TWMLButtonDown");
TCustomPanel::Dispatch(&Message);
}
but it is not work.
How can I cath that message in MyCompoent?
Thanks a lot.
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Sep 22, 2003 4:33 pm Post subject: Re: How can I catch TWMLButtonDown Message in Dispatch metho |
|
|
"Jilaing" <Jialing (AT) yaho (DOT) com> wrote
| Quote: | void __fastcall TMyComponent::Dispatch(void *Message)
{
switch(((PMessage)Message)->Msg)
{
MESSAGE_HANDLER(WM_LBUTTONDOWN, Messages::TWMLButtonDown,
WMLButtonDown)
default:
TCustomPanel::Dispatch(Message);
break;
}
}
|
You're trying to use a MESSAGE_MAP, but you're only using half of it. You
should be using the BEGIN_MESSAGE_MAP and END_MESSAGE_MAP macros as well:
class TMyComponent : public TCustomPanel
{
private:
void __fastcall WMLButtonDown(Messages::TWMLButtonDown &Message);
public:
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(WM_LBUTTONDOWN, Messages::TWMLButtonDown,
WMLButtonDown)
END_MESSAGE_MAP(TCustomPanel)
};
void __fastcall TMyComponent::WMLButtonDown(TWMLButtonDown &Message)
{
ShowMessage("TWMLButtonDown");
TCustomPanel::Dispatch(&Message);
}
| Quote: | but it is not work.
|
Just saying "it does not work" says nothing at all about the actual problems
you are experiencing. Always explain, in detail, exactly what is happening
(or not happening), any errors that are occuring, etc.
Gambit
|
|
| Back to top |
|
 |
Jialing Guest
|
Posted: Tue Sep 23, 2003 7:06 am Post subject: Re: How can I catch TWMLButtonDown Message in Dispatch metho |
|
|
| Quote: | You're trying to use a MESSAGE_MAP, but you're only using half of it. You
|
I catch other message such as TWMMove, TWMSize, TWMMoseMove
without any problem, and only TWMLButtonDown has problem.
| Quote: |
void __fastcall TMyComponent::WMLButtonDown(TWMLButtonDown &Message)
{
ShowMessage("TWMLButtonDown");
TCustomPanel::Dispatch(&Message);
}
but it is not work.
|
I expect that when I left click on MyComponent in design time
the message of "TWMLButtonDown" is shown to me, but it is not
show or ShowMessage("TWMLButtonDown") is not called.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|