Notification


Attributes of class N are notificable by an object to another object.

It means that you can instruct RxMUI to notify an object B when an attribute of an object A changes.

Notification of attributes is really important: you may not take any attention on some events.

 

Let's suppose you have a Radio object A and a Cycle object B and you want to connect them so that when the active entry in A changes the active entry of B is changed.

What you must do is to make B SET its attribute Active every time the attribute Active of A changes.

It is done via the call:

    res = Notify("A","Active","EveryTime","B","Set","Active","TriggerValue") 

We instruct RxMUI to:
Every Time the attribute Active of object A changes, invoke the method Set on the object B with argument Active and the same value that triggered the notification (TriggerValue)

 

Another example:

Let's suppose you have an object called MAboutMUI and you want to open the AboutMUI window anytime the user selects that item (app is an application object):

    res = Notify("MAboutMUI","MenuTrigger","EveryTime","app","AboutMUI")

We instruct RxMUI to:
EveryTime the MAboutMUI is selected (and so its attribute MenuTrigger changes) invoke the method AboutMUI on the object app

 

Another example:

Let's suppose you have a button named rem and a Listview named  lv and you want to remove the active entry of lv anytime the rem is pressed:

    res = Notify("rem","Pressed",0,"lv","Remove","Active")

We instruct RxMUI to: 
When the attribute Pressed of rem is 0 (it means the button was pressed) invoke the method Remove on lv with argument Active

 

The arguments of Notify() are:

<notifier/V>,<attr/V>,<value/V>,<target/V>,<method/V>,{parms}

The rules are:

  1. Only attribute of class N can trigger the notification (be the second argument in Notify())
  2. If a parameter of the method is triggered the attribute must be of type N or G2N ; it can be S but with len<=64
  3. method bust be a valid method for target
  4. If method is SET: if the parameter is not trigger it must be of the same type of attribute or attribute must be G2N and the parameter N .
  5. Any class defines its rules for its own methods.

Setting up notifications may cause potential dangerous situations. The result of a set of notifications may be a dead-lock as in:

    call Notify("cycle","active","everytime","radio","set","active","triggervalue")
    call Notify("radio","active","everytime","cycle","set","active","nottriggervalue")

RxMUI solves this problem checking the stack : if the free stack is less than a fixed value, the invoked method is not executed. It fixes the whole problem. The stack limit value is user-settable.