rokubrightscriptscenegraph

How to re-render content node / list upon Keyboard Entry?


I have a custom markup list that I am displaying two labels. The second label, displays a value that I have saved in the registry.

Upon clicking on the item, a keyboard dialog displays and the user can type in some information to then be saved.

I am successful in saving the new value to the registry, however I want to display the new value to the content node. How can I re-render the content node or have access to the label?


Solution

  • You can access the label using a field interface in the XML markup. A more effective way of doing this would be to actually changing the Content Node that is being fed into the MarkupList. Based on the Data Bindings for the MarkupList on the Roku SDK: https://sdkdocs.roku.com/display/sdkdoc/MarkupList, it looks like you would need to have a parent content node and a child Content node for each item. So, I would access this ContentNode in the .brs file by assigning an id to it and then using m.top.findNode(). Then, you should create a Content Node with the appropriate information for the label and use the getChild()/appendChild() method nodes to access and mutate the ContentNode itself. Finally, you should have an observeField() method that looks at the change in the content field of the Markup place, which would then re-render the MarkupList with the updated text.

    Here is a resource for navigating the Content Node tree and adding children in the .brs file: https://sdkdocs.roku.com/display/sdkdoc/ifSGNodeChildren#ifSGNodeChildren-getChild(indexasInteger)

    Hope this helps!