I am trying to make my own custom editable Sendable. In my initBuilder() method I have this code:
builder.addDoubleProperty(key.getName(), () -> valueMap.getDouble(key), (value) -> valueMap.setDouble(key, value));
where key and valueMap are from my project and builder is a SendableBuilder. (I provide a getter and a setter)
If I add the sendable to a tab in Shuffleboard, I cannot edit the values even though I have a setter. When I add it to SmartDashboard it gives me multiple options and I can edit them. Is there a way to do this through Shuffleboard without having multiple editable values and just have them in a single Sendable? Also note I’ve tried this with Strings too and they aren’t editable either.
Bump. Anyone have ideas on this issue?
An ugly way to get around this is add a bunch of variables to a list layout. For each value you add, you can add a listener to the NetworkTableEntry. I created a class to automate it and eventually might put it in my github.
Can you be more specific in what are you trying to do? What does your custom Sendable class look like?
For any custom sendable that extends SendableBase, when I put it in a Shuffleboard Tab, in that tab I am unable to edit it even though I added a setter when I added the property in initSendable(). If I put that same Sendable in SmartDashboard, I would be able to edit the values, however in a tab, it does not give me the option to edit it.
A custom sendable needs a custom widget, unless you reuse an existing WPILib smartdashboard type. It’s been a while since I’ve looked at this part of the codebase, but I’m pretty sure the default widget for a sendable with an unknown or missing type is a read-only table view.
For example, you can call builder.setSmartDashboardType("RobotPreferences")
to make it use the preferences editor widget
1 Like
Ah that’s why it’s read only. I’ll try setting the dashboard type to that and see if it’ll let me edit the values. Documentation for stuff like this is difficult to find in WPILib. I end up looking at source code most of the time.