I have again a problem and I do not see the solution of it. I want to implement a selection within a selection. I have worked with styles, so the two different selections could be distiguished. The second get an additional label and for that label a different selection style is configured. My problem is, that if if select a cell within my first selection, I lose my first selection. Is there any way to keep the first selection?
I tried also to select the rows for the first selection again after the second one was done, but then I lose the second selecton
The selection is done by mouse or keyboard, not programatically.
First somehow a preselection of item should be done, that are marked for selection. This selection should be kept and always be visible, so the user could see the marked items.
With the second selection (that is in the row range of the first) the use selects the items he wants to edit. It could be one cell or more cells.
I preselect row 5-15 ( first selection) and then I select the second cell of the rows 7-10. The selected rows 5-15 should be visible in a different color, let us say grey and the cells marked for editing in another color, let us say green.
My problem is, that at the moment I mark the cells for editing, I lose the first selection.
Never heard of such a use case related to selection. And I think technically this is not possible if you only think of selection.
For the "preselection" you don't need to really select anything. At least I don't see the the reason why it should. So maybe a solution would be to perform something like a selection. You are talking about items that are marked somehow. I guess you want to tell your user at which items he should focus. Why not marking these items with another mechanism than selection and add labels to those cells. So you are able to highlight them to the user. On top everything is possible using selection and editing as you know.
Or do you mean with "highlight them" to do it like in the example "Custom_styling_of_specific_cells" (adding config labels). I have done this. But I lose the highlighting when I start the second selection.
Well, from the perspective of a user, architect and UI ergonomist
Let's assume the user selects those rows to be able to lock:
1. user selects the rows
2. user performs some custom action to execute locking
3. the user can select and edit in the fields
1. user performs a selection, which needs to be a real selection so the lock function can operate on that
2. after the lock operation has succeeded you need to tell your model about the lock state. this way you are able to perform conditional styling on the lock state
3. the first selection can be removed and sub selections can be performed as the lock state is made visible via conditional styling rather than selection state
The labels are calculated again on every refresh. The LabelStack is not persistent. So you need to add some attribute to your model object or introduce some other mechanism that is able to track which rows are locked, so the information can't get lost on rerendering.
in the accumulateConfigLabels I think I have such an persistent mechanism. The labels are marked according to the both selections which where done (both selection-rectangle objects are "stored"). But when I do the second selection the first custom style gets lost. If I perfom the first selection again, then it looks as I want it.