Page MenuHomeFeedback Tracker

Clearing curSel for treeView controls does not work
Closed, ResolvedPublic

Description

_control tvSetCurSel [-1] does not produce expected result. The whole command does not seem to work as expected. If control has multiselectEnabled = 1, the command will keep the current selected element and then add the element that is set by tvSetCurSel.

When trying to clear all selected items, the command seems to not work at all.

UPDATE:
The work around is to clear the treeView then 're-add' the items

Details

Legacy ID
529868411
Severity
None
Resolution
No Bug
Reproducibility
Always
Category
Scripting
Steps To Reproduce

Create a tree view control. Add elements to it. Select element(s). use tvSetCurSel [-1] to clear all selected items. (NO CHANGE)

Additional Information

NONE - as of time ticket created

Event Timeline

Bohemia edited Steps To Reproduce. (Show Details)Feb 10 2016, 7:42 PM
Bohemia edited Additional Information. (Show Details)
Bohemia set Category to Scripting.
Bohemia set Reproducibility to Always.
Bohemia set Severity to None.
Bohemia set Resolution to No Bug.
Bohemia set Legacy ID to 529868411.May 8 2016, 1:42 PM

Which version are you testing this on? I have tried it on latest dev and when multiselect is enabled, tvSetCurSel can only select 1 row at a time, and if you select multiple rows manually, they all get deselected when [-1] option is supplied

Bohemia added a subscriber: Bohemia.May 8 2016, 1:42 PM

It is on the main build. I have used the _CT_TREE from Karel's Template as the base definition (just to be sure it's correctly defined) then I have made my custom RscDisplayXXXX. I have debugged the code and cannot find any syntax error, and I have made sure the correct types are input into the command. It could be that I'm not scripting correctly, but as I said, I can't find anything wrong with the syntax plus -showScriptErrors doesn't throw an error

Here is my code (executed upon a button press event):
case ("buttonclearselection"): {

_params params [
  ["_control",controlNull,[controlNull]]
];
_display = ctrlParent _control;
_unitTreeCtrl = _display displayCtrl 181;
_unitTreeCtrl tvSetCurSel [-1];

};

The deselect all option [-1] was added recently and on BIKI is says since what version number it should be available. Are you testing this on version that is newer than the one it was added in?