How custom widget get notify from TrigML | developer.brewmp.com How custom widget get notify from TrigML | developer.brewmp.com

Developer

How custom widget get notify from TrigML

I write TrigML application with custom widget and Actor.
TrigML app and custom widget need to communicate each other.
I try to send text notification from TrigML to custom widget.

On custom widget initialization, my custom widget creates 1st instance of ValueModel and
adds listener on the ValueModel by ModelListener_InitEx().

On actor initialization time, my Actor creates 2nd instance of ValueModel and associates with the node by IVFSNODE_SetData(). My TrigML app's initialization is successfully done.

On user key event, my Actor modifies the ValueModel by IVALUEMODEL_SetText(). But it crashes in IVFSNODE_Notify(). Do you know why it crashes?

I wonder the listener of custom widget is associated with 1st instance of ValueModel. After my Actor creates 2nd instance of ValueModel. Does the listener automatically switch to 2nd ValueModel?

Thanks,

Hi,
Without knowing the details of your implementation, I can only suggest what I think may be the problem.
I would suggest that your widget should not be creating the first value model, as this is done by your actor when the TrigML widget element has its res attribute processed by Trigplayer. Your custom widget would then set up a model listener when its IWIDGET_SetModel() function is called (by Trigplayer). Then, when you change the model's data (from within your actor's event handler), your model listener will be called.
Using a static widget and value model as an example, when Trigplayer calls IWIDGET_SetModel() to set the static widget's model (that an actor has created), the static widget initialises a model listener and adds it to the model. When the model's data changes, the listener callback is called, which tells the static widget to update itself.
Sam.

Hi,
Without knowing the details of your implementation, I can only suggest what I think may be the problem.
I would suggest that your widget should not be creating the first value model, as this is done by your actor when the TrigML widget element has its res attribute processed by Trigplayer. Your custom widget would then set up a model listener when its IWIDGET_SetModel() function is called (by Trigplayer). Then, when you change the model's data (from within your actor's event handler), your model listener will be called.
Using a static widget and value model as an example, when Trigplayer calls IWIDGET_SetModel() to set the static widget's model (that an actor has created), the static widget initialises a model listener and adds it to the model. When the model's data changes, the listener callback is called, which tells the static widget to update itself.
Sam.