BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can I catch TWMLButtonDown Message in Dispatch method?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
Jilaing
Guest





PostPosted: Mon Sep 22, 2003 9:29 am    Post subject: How can I catch TWMLButtonDown Message in Dispatch method? Reply with quote




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





PostPosted: Mon Sep 22, 2003 4:33 pm    Post subject: Re: How can I catch TWMLButtonDown Message in Dispatch metho Reply with quote




"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





PostPosted: Tue Sep 23, 2003 7:06 am    Post subject: Re: How can I catch TWMLButtonDown Message in Dispatch metho Reply with quote




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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.