[haiku-3rdparty-dev] Re: Finding property changes in a widget or BControl

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Fri, 13 Nov 2009 10:18:22 +0100

Hi,

On 2009-11-13 at 08:51:38 [+0100], Yashasvi A.C. <yashasviac@xxxxxxxxx> 
wrote:
> I have been trying to capture messages to find out when the property of a 
> specific widget has changed. Thus, when a "button goes disabled" or a 
> "checkbox is checked" or something similar, I attached a filter to these 
> widgets to catch messages like _DIS (for disabled) or _CHE(for checked). 
> Those message names are just examples to explain what I am trying to 
> catch. :)
> 
> I have put in a filter for each widget in the parent window using:
> *fWidgetFilter = new BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE,
> (filter_hook) &BALM::widget_message_hook);
> 
> for (int32 i = 0; i < parent->CountChildren(); i++)
>      fParent->ChildAt(i)->AddFilter(fWidgetFilter);
> 
> *So, inside the widget_message_hook() function, I pretty much display the
> message->what as 4 characters. Whenever I hover, the mouse over the 
> button or checkbox, I get the _MMV message. A click gives me _MDN and 
> _MUP messages. That is perfect. But, I cant get the property state 
> changes to pop up as a message. Am I doing something wrong? Or does Haiku 
> work differently for property changes and not create a message? If so, 
> how can I capture it? I am trying to get a generic function going so that 
> I can just put in an event handler for all the widgets (like the for loop 
> above) and just print out the messages.

IIRC, I already replied to your problem with one specific solution. But I 
just now have Internet access again, so I have a lot of catching up to do. 
I don't know if you already replied to my message. In any case, it sounds 
like you still have the exact same problem as before, and my original reply 
would still be a good solution. If you have not already responded, please 
try to ask specific questions you have with regards to the solution I 
already provided.

> Also, the BTextControl works strangely different. The moment the focus 
> goes inside the text box, the _MMV, _MDN, _MUP messages stop displaying. 
> Also, I cant seem to capture the key change events which I could catch 
> before. Does BTextControl have some sort "absorbing" functionality for 
> the messages and not let them get displayed? I am quite baffled. :( I 
> would like to get messages related to the text box as well.

The BTextControl is a compound widget (same as BMenuField/BOptionControl). 
It embeds another view, so the mouse events go to that one.

Best regards,
-Stephan

Other related posts: