OpenDCL Forums

OpenDCL => Studio/Dialog Editor => Topic started by: Jim Short on October 14, 2015, 06:26:35 PM

Title: (dcl-ListView-getCurSel returns 2 when no row selected.
Post by: Jim Short on October 14, 2015, 06:26:35 PM
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?

Title: Re: (dcl-ListView-getCurSel returns 2 when no row selected.
Post by: owenwengerd on October 15, 2015, 12:32:01 AM
SetCurSel works only for single-selection list boxes. For multiple-selection list boxes, use(dcl-ListBox-SelectItem) (http://www.opendcl.com/HelpFiles/index.php?page=Reference/Method/ListBox/SelectItem.htm) or (dcl-ListBox-SelItemRange) (http://www.opendcl.com/HelpFiles/index.php?page=Reference/Method/ListBox/SelItemRange.htm).
Title: Re: (dcl-ListView-getCurSel returns 2 when no row selected.
Post by: Jim Short on October 15, 2015, 05:48:52 AM
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
Title: Re: (dcl-ListView-getCurSel returns 2 when no row selected.
Post by: owenwengerd on October 16, 2015, 06:28:07 AM
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.