Universal Robots Forum

Dynamically inserting HTML into installation node

I’m looking to display messages to the user in the installation node. For a simple example, when the user clicks button ‘A’, I want a message that says “You clicked A.” And when they click button “B”, it says “You clicked B”.

Mock structure:

<button>A</button>
<button>B</button>
<message></message>

The message tag should get filled with the text corresponding to whatever button was most recently pressed.

Rooting around the API I couldn’t find any obvious way to do that. com.ur.urcap.api.ui.component.[HTMLComponent,DivComponent] interfaces only allow enabling and disabling.

Thanks

I would suggest to use <label id="message"/> and handle button event in java source to change the message content.

That’s essentially what I’m trying to do, but I don’t see a way to change the HTML using the UR API. Can you please be more specific?

Add a LabelComponent in the Java side with an annotation that matches the id:

@Label (id = "message")
private LabelComponent messageLabel;

Then in the openView, or in the callback of the buttons, set the text using that component handler: messageLabel.setText("whatever you want")

2 Likes