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

  • From: "Yashasvi A.C." <yashasviac@xxxxxxxxx>
  • To: haiku-3rdparty-dev <haiku-3rdparty-dev@xxxxxxxxxxxxx>
  • Date: Fri, 13 Nov 2009 20:51:38 +1300

Hi!

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.

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.

Thanks for all the help guys! :)

Thanks and regards,
Yash

Other related posts: