Developer

API Reference

IListModel_AddListener()

Brew Release
Brew MP 1.0.2
Description
This function allows objects such as widgets and UI controls to attach a listener to the given list model. The listener includes a callback function that BREW will call whenever the model has changed state, thereby notifying the owner of the listener that data has changed. For example, consider a model that derives from IListModel that manages a list of on-line buddies, fetched occasionally from a server. The widget that registers itself as a listener for this model would be responsible for displaying the list of buddies, while the list's size, position and other data attributes would be managed by the derived list model (the actual data to be displayed would likely be managed by a text or value model). The "buddy widget" would register as a listener for the derived list model by calling the AddListener routine for the derived model. As buddies come on-line or go off-line, the model would send out notifications to any registered object with updated information about changed information in the model. The buddy widget, for example, as a listener of the derived list model, might then update its display to reflect the current list of on-line buddies.
Parameters
  • pif
    []:
    Pointer to the IListModel interface object.
  • pl
    []:
    Pointer to the ModelListener that will be attached to the object. The ModelListener will contain the PFNLISTENER callback function BREW will call to notify the registering object of changes to the value model.
Interface
Prototype
   int IListModel_AddListener(IListModel *pif, ModelListener pl); 
Return
   AEE_SUCCESS          - Listener successfully added
   AEE_EBADPARM         - Invalid argument
   ENOMEMORY            - Insufficient memory
Side Effect
None
Comment
None
  • Follow