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

  • From: "Yashasvi A.C." <yashasviac@xxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Wed, 18 Nov 2009 02:29:44 +1300

On Tue, Nov 17, 2009 at 11:06 PM, Stephan Assmus <superstippi@xxxxxx> wrote:

> Hi,



>
> Do you see what I mean now? Any code could disable a control by calling
> SetEnabled(false), and no message passing would be involved that you can
> catch and filter. But by extending the BControl class itself to send out
> notices when the property changes, you force BMessages to be sent to
> registered observers. This needs to be added everywhere you need it.
>
> Additionally, you need a way to register remote observers. And once you are
> done, you can use this technique to solve your problem.
>
> Best regards,
> -Stephan
>
>
Hi,

I think I understand what needs to be done now. So, basically, the
SendNotices() method is used by the BControl class whenever a specific
message needs to be sent. So, for example, if there is a method called
SetText() in the BTextControl class (just an imaginary example), there is a
SendNotices() call within its implementation to send a message denoting that
the text has been changed. However, from what I understand, this call is not
present in the BControl's SetEnabled() method. Am I right?

So, what needs to be done is that the SendNotices() call should be
implemented in pretty much every property change that we need a message for.
I will speak to my supervisor, Christof tomorrow and talk to him about this
approach. I will report back what happens with our discussion.

On the other hand, the SendNotices() is called within some methods in the
BControl. It is called when the value is changed or something similar (Axel
had mentioned this before). So, when the value of a control is changed, the
SendNotices() sends a message. How do I go about creating an "event"
listener to listen to what SendNotices() sends? I do understand that it will
not work for property changes, but I would like to test it and see if I can
at least capture value changes where the call to SendNotices() has already
been implemented. So, basically, I would like to be on the receiving end of
the SendNotices() call. Is there something like ReceiveNotices() or
something similar?

Regards,
Yash

Other related posts: