setSelected() For ProgramNodes

Summary

Simulates the user selecting a program node from the program tree

What is it?

This would be a nice quality of life improvement for the user if they were to add or delete children for example. If I add a child, I may want to immediately display this child to the user instead of making them manually select it.

Why is it needed?

Currently, when you add a child, the user remains on the parent page. When demonstrating our CAP to customers, they often assume that after pressing “add child” that they are now editing properties for said child, when in reality they are still on the parent page.

We also lock the ability to add children through the buttons on the left so the user cannot add any built in Polyscope functions, but instead are restricted to the moves we allow. This means that if we delete a child from itself, the “Robot Program” always gets selected by default. I would like to automatically select the previous child (if it exists) or the parent if the last child has been deleted. Basically being able to replicate how the built-in delete button works, since this cannot be used in a setChildLockSequence(true) scenario.

3 Likes

Hi,
Did you ever find a way to do this, or failing that, does anyone know if this has been done? Programatically setting the focus of the program tree is something we are keen to implement to a URCap.
Thanks,
Sam

The short “not giving away company code” answer is yes, I found a way to do it. So yes, it can be done. Unfortunately much more involved than just just having the setSelected() option like I asked for 3 years ago (jeez it’s been 3 years?) I haven’t seen a whole lot of UR staff involvement on the wishlist stuff in a long time.

Hi,
can you give a short explanation, of how you found a solution?
We already think about a workaround with display Mouse and keyboard… Not the cleanest solution at all…

I used a Focus Listener to get access to an underlying component of the Polyscope GUI while it boots up and the recursed until I found the parent container, then traversed the whole UI tree until I found the program tree and stored that to a variable in Java. That lets you do things like “programTree.setSelected(blah)”