[haiku-development] Re: Intercepting messages between the applications and App. Server
- From: "Yashasvi A.C." <yashasviac@xxxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Sat, 30 May 2009 00:47:36 +1200
Hey guys,
Thanks for the help. I figured it out. :) Was a problem with the namespace
of the function.
When I try to print out message->what, it prints out a number like
1400700986 or something similar of that sort. Is there any way where I can
access the name of the message, like MOUSE_DOWN or CLICK or something like
that? Under BMessage, only "what" is listed as a data member.
Thanks once again for the help.
Yash
On Sun, May 24, 2009 at 5:24 AM, Karsten Heimrich <host.haiku@xxxxxx> wrote:
> Hi Yashasvi,
>
> Yashasvi A.C. schrieb:
>
>> Hey,
>>
>> I used the given code extract but an error saying "no matching function
>> call
>> to BMessageFilter (message_delivery, message_source, {unkown type})"
>> occurred. Then, I realised that perhaps it was supposed to be
>> message_print_hook() function call i.e. with the brackets, while
>> initialising fMessageFilter. I am not sure what parameters need to be
>> passed
>> to message_print_hook().
>>
>> My code kinda looks like:
>> <code>
>> BMessage* msg = new BMessage();
>> BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, message_print_hook(msg, this,
>> fMessageFilter));
>> </code>
>>
>
> it could look like this:
>
> static filter_result
> message_print_hook(BMessage* msg, BHandler** target,
> BMessageFilter* filter)
> {
> // do something
>
> return B_DISPATCH_MESSAGE;
> }
>
> MyView::MyView()
> : BView(/*init parent*/)
> {
> BMessageFilter* filter = new BMessageFilter(B_ANY_DELIVERY,
> B_ANY_SOURCE, &message_print_hook);
> AddFilter(filter);
> }
>
> You should probably read up on how to use function pointers.
>
> http://www.newty.de/fpt/index.html
>
> http://www.haiku-os.org/legacy-docs/bebook/BMessageFilter.html
> http://www.haiku-os.org/legacy-docs/bebook/BMessageFilter.html#filter_hook
>
>
> Regards,
> Karsten
>
>
- Follow-Ups:
- References:
- [haiku-development] Re: Intercepting messages between the applications and App. Server
- From: Yashasvi A.C.
- [haiku-development] Re: Intercepting messages between the applications and App. Server
- From: Rene Gollent
- [haiku-development] Re: Intercepting messages between the applications and App. Server
- From: Yashasvi A.C.
- [haiku-development] Re: Intercepting messages between the applications and App. Server
- From: Karsten Heimrich
- [haiku-development] Re: Intercepting messages between the applications and App. Server
Other related posts:
- » [haiku-development] Intercepting messages between the applications and App. Server - Yashasvi A.C.
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - Rene Gollent
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - Stephan Assmus
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - Yashasvi A.C.
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - Rene Gollent
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - Yashasvi A.C.
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - Jérôme Duval
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - Karsten Heimrich
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - Yashasvi A.C.
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - André Braga
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - Jérôme Duval
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - pete . goodeve
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - Yashasvi A.C.
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - Rene Gollent
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - Yashasvi A.C.
- » [haiku-development] Re: Intercepting messages between the applications and App. Server - Stephan Aßmus