Similar to how array and cluster constants on the block diagram can be edited, it would be useful to be able to edit map and set constants on the block diagram.
In the map constant above, the developer can scroll through and see all of the key value pairs in the map (plus an empty element at the end of the map).
It would be useful to also be able to edit the key-value pairs in the map (and add more key-value pairs to the map by changing the empty element at the end of the map).
Yeah. This would be nifty. The UI experience was so frustrating that we abandoned it. If you have proposals for specifically how it would work, my team is interested. Specifically:
1. What constitutes "committing" a change to the constant such that sorting is reapplied? Or does a new/changed element immediately sort into position?
2. In a map, if you change or add a key that matches an already existing key, what happens to the conflicting value?
3. In a set, do you need feedback when two elements consolidate?
We kept coming back to some sort of "pop open a dialog where you change the contents and then commit the changes", but it felt really cumbersome. If you have better ideas, post them, please.
1 - I imagined it being the same as committing a change to any other constant. When you finish typing and either click somewhere else or hit enter, it commits the change.
I wondered about sorting too. I think it would make sense for it to happen when you commit the change (for a map, sorting only has to happen if the key changes), and for it to keep the element you were just editing visible. So, after committing a change to an element, the scrollbar would move and the size would change. That way, you could continue editing that same element.
2 - In a map, if you try to commit a change that changes or adds a key to match an already existing key, nothing happens (maybe the error sound plays) and the map switches to view the already existing key.
3 - I don't think feedback is necessary, but it would make sense for the set to behave similarly to the map. If you add an element that is already in the set, nothing happens and it shows you the other element. If you change one element to match another element, nothing happens and it shows you the other element.
"I imagined it being the same as committing a change to any other constant. When you finish typing and either click somewhere else or hit enter, it commits the change."
Imagine if the key is a cluster with two fields. You edit one of the fields and click on the second field. Normally, that would commit the value change in any other constant. Does it do the same here? If so, you could end up stomping on values you never intended to interfere with. This alone means there's some sort of "meta edit" operation that needs to be started (somehow).
I hadn't thought about that, but I think what I described in response to your 2nd question (if you try to commit a change that changes or adds a key to match an already existing key, nothing happens) would work for that case.
Specifically, for a key that is a cluster with two fields:
> If there is already an element with that key, the commit fails
> and the map constant reverts to its previous value
I have an existing map of :[1, 1] -> "abc"
[2, 1] -> "def"
I want to change the key of the first entry to be [2, 2]. I change the first "1" to a "2"... and LabVIEW immediately reverts the edit when I click in the next field?
Cluster keys are not nearly as common as strings or ints, but they aren't rare. It's not a use case we could just let hang out there weirdly, especially if it lead people to think they had made an edit when in fact they had not. This was among many editing weirdnesses... all small, but collectively complex. So we punted editing out of the release to let smarter minds than us design it. 🙂
By the way... if anyone wants to build an editor for the constants, you could create a custom right-click menu option and write the code for the editor to show us what you'd like to have. I'm literally throwing my hands up and saying, "I have no idea what a good UI interaction for these things looks like."
Instead of committing a change when a cluster key's field is modified, could you only commit the change when the user clicks outside the cluster's fields (i.e. clicking on the value, clicking on blank space in the cluster, or clicking outside the set/map constant). For array keys, it would probably be similar except that the user can also click on the scrollbar and/or index display without committing the change. On commit, the behavior could be as tannells described.
This could still be frustrating if the user is copying values from somewhere else, but, for normal editing, it should be fine.
I don't know if there is any other verification/committing process that is done when users click off of constants, but (if so) that should be done at the same time it normally would (i.e. if the first cluster key element would have some sort of verification, it would happen when clicking on the second element, while verification of the key as a whole would happen when clicking outside the cluster elements).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.