(dcl-ListView-getCurSel returns 2 when no row selected.

Started by Jim Short, October 14, 2015, 06:26:35 PM

Previous topic - Next topic

Jim Short

Deselect Items:
_1_$ (dcl-ListView-SetCurSel Std/ToolSelect/lstTools -1)
T
Get the current selection: Should be -1
_1_$ (dcl-ListView-getCurSel Std/ToolSelect/lstTools)
2
_1_$ (dcl-ListView-GetSelectedNths Std/ToolSelect/lstTools)
nil
_1_$

Does dcl-ListView-GetSelectedNths return nil to represent empty list?

Jim Short

owenwengerd

SetCurSel works only for single-selection list boxes. For multiple-selection list boxes, use(dcl-ListBox-SelectItem) or (dcl-ListBox-SelItemRange).

Jim Short

I believe the two functions you have mentioned pertain to ListBox and not ListView.
Is there a way to improve the help description http://www.opendcl.com/HelpFiles/index.php? to give more information.
I am going to look at (dcl-ListView-GetSelCount to determine whats is currently selected. I do not see a way to programmatically select more than one item. Not sure why one would ever want to.
Thanks, Jim
Jim Short

owenwengerd

Oops, I missed that you were using a ListView. I was able to reproduce the problem, and it is now fixed for the next build.

GetSelectedNths should return an empty list (and NIL is the empty list) if no items are selected. The reference documentation is purposely very concise, but please let me know where you think it can be improved.