Hi guys, I am working on my first URCap application in my company. I wanted to make a demo URCap for a pneumatic gripper. What the URCap should do: - turn on/off certain output that the user chooses with the help of combo box - toolbar with test buttons to test certain outputs
And… the problem occurs in the toolbar when I want to test previously chosen output. Here are the screens. Advice appreciated as I have just started with Java Swing and URCap development.
The situation when I do not refer to setIOcomboBoxItems and Selection method which is brought from contribution.
And… when I refer to it.
If someone decides to help me with code analyses just DM me on the forum.
This link explains the use of Java Swing in context of URCap development. It also includes an explanation of how to use a combo box. More information about the datamodel can be found under API Reference.
Something that could cause the problem that you are getting is the line in the code that is currently show in the picture: “liveControl.openView()”. Else I would like to see how you have implemented the set I/O part when a user have chosen a value in the combo box.
Thank you for the code on Github. I have looked into why you are getting the error when trying to use the combo box in your toolbar. The problem may lie in the fact that you are trying to use Undo Redo Manager and Datamodel in your ToolbarContribution class. First thing is because these two instances are never initialized and because it is not possible to use these in context of Toolbar nodes. But as you can see, it is accessible in the program node which is your GripperContribution class :
So when you have the following in your ToolbarContribution class where you outcommented the last line like the following:
You will not get nullpointer exception right away. The reason for the exception is because it will try to call the Datamodel which is not initialized or accessible. For more information on what is accessible through the api, have a look at this article: https://plus.universal-robots.com/getting-started/urcap-api-overview/