Using value with repeating structures

18 views
Skip to first unread message

James Elliott

unread,
May 18, 2016, 1:20:30 PM5/18/16
to seesaw-clj
Hello, everyone, I just started using seesaw this past week in order to put together a user interface that will be helping coordinate visuals for a DJ at a music festival this weekend, and it has been delightful. The current state of my code can be found at https://github.com/brunchboy/beat-link-trigger

I am starting to think about how to flesh this out into a full featured tool, and that will involve saving and loading configurations.  Plus I want to be able to have multiple triggers in the same window.

The value function described at https://github.com/daveray/seesaw/wiki/Widget-value looks like a fantastically convenient way to get UI state into and out of an edn file, but I am running into a conceptual brick wall if I want to be able to have a repeating panel in a scrolling list. The problem is that I would end up with multiple widgets with the same id in the parent frame, which (I believe) is a problem, even though that would be most convenient for me because I would always be accessing them at the level of the panel, wherein they are unique.

How have people dealt with this in the past? I could build synthetic ids, so each panel gets a unique number added to its id keywords, but this would lead to weird ids in the value that get saved to the edn file, and just sounds awkward and inconvenient. Am I missing something? Is it ok to have widgets with the same id in the same frame as long as I only search for them and ask for values from a point in the widget tree beneath which the ids are unique?

James Elliott

unread,
May 20, 2016, 12:46:56 PM5/20/16
to seesaw-clj
Nobody has said anything, so I went ahead and tried creating multiple panels with components inside them whose IDs are unique within the panel, but not the entire frame. This seems to work exactly as I need it to: I can select things fine at the panel level, and get and set the value of each panel as a unit, which makes saving and loading my state very easy. Things don’t make sense trying to select or get values starting at the overall frame, but I never need to do that anyway.

So, if I am heading towards a cliff, please let me know, but it seems fine so far.
Reply all
Reply to author
Forward
0 new messages