Our robot program creates a Shuffleboard tab and then creates a layout of type Klist. It then adds numeric items to that list. The list items when viewed in the outline viewer are ordered alphabetically. When you look at the tab on Shuffleboard, the items are ordered randomly. If you reposition the items, the next time you run that new order you set is lost and the items are again ordered randomly (or at least no ordering I can identify). Is there a way to control the order the list layout displays items added to it? Saw a post from 2020 saying no, but maybe something has changed or someone figured out a way…
Shuffleboard hasn’t really been maintained these past few years. It’s kept alive, and PRs are accepted, but there isn’t any active development of new features.
Therefore, I expect the situation to be the same as in 2020 unless someone PRs it.
You can make tabs in shuffleboard and set widgets to specific sizes and positions in the tab
This was our organized shuffleboard from rapid react offseason
Widgets in layouts defined by a robot program will generally appear in a random order, since it’ll add widgets in the order networktables notifies shuffleboard about the tables. NT4’s switch to pub/sub might have added a better way to receive notifications in the same order they’re sent; I haven’t looked into it. It should be fairly simple to add a metadata tag to the layout’s metadata table to keep a list of the things that have been added to it, then use that on the shuffleboard side to insert widgets in the correct order.
Barring updates to wpilib and shuffleboard, you might be able use a grid layout with 1 column and specify a row index on the widgets to keep them ordered. I haven’t tested this, but something like this could work:
int rows = 5; // or however many you want
var list =
Shuffleboard
.getTab("Example Tab")
.getLayout("Fake List", BuiltInLayouts.kGrid)
.withProperties(Map.of("Number of columns", 1, "Number of rows", rows));
list.addBoolean("Always False", () -> false)
.withWidget(BuiltInWidgets.kBooleanBox)
.withPosition(0, 0); // place the first widget in row 0
list.addBoolean("Always True", () -> true)
.withWidget(BuiltInWidgets.kBooleanBox)
.withPosition(0, 1); // place the second widget in row 1
I assume you are talking about laying it all out in Shuffleboard which is saved and then matching the items names up to code as opposed to having the layout created dynamically from the code?
This seems workable. When I get time I will try it out. Thanks.
No, you can create the layout in the code - the docs are in that link. Essentially, you can choose the size with .withSize()
and position with .withPosition()
of each widget as you ask Shuffleboard to display them in code.
If you don’t have a robot, you can also create the layout using robot simulation and opening shuffleboard
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.