Can't get first item in the list to be selected during initialize.
is this possible to do?
(defun c:Onset_StandardFeatures_OnInitialize (/)
(dcl_Control_SetEnabled Onset_StandardFeatures_btnOK False)
(dcl_Control_SetList Onset_StandardFeatures_lstFeatures (tcam:stdFeatures))
(dcl_ListBox_SetFocusIndex Onset_StandardFeatures_lstFeatures 0)
(dcl_ListBox_SelectItem Onset_StandardFeatures_lstFeatures 0)
)
Did you have a try with SetCurSel method insteand of SelectItem?
In ancient times SetCurSel was described for using in ListBoxes with SingleSelectionStyle and SelectItem for MultiSelectionStyle. I had a look at the new documentation, there's no word about this difference.
@Owen: Does this difference still exist? Should we add this to the documentation then?
Fred
Yes, SelectItem only works if multiple selection is enabled. I also see in MSDN that passing -1 for the ItemIndex applies it to all items.
I will add the following to the end of the descriptions for ListBox_SelectItem, ListBox_SelItemRange, DWGList_SelectItem, and DWGList_SelItemRange:
This method does not work for single-selection lists (see SelectionStyle).
For ListBox_SelectItem and DWGList_SelectItem, I will add the following after the first sentence:
If ItemIndex is -1, all list items are selected or deselected.
Interestingly, it looks like ListView_SetCurSel and BlockList_SetCurSel have semantically the same behavior as ListBox_SelectItem. It seems to me that SetCurSel should be removed for all of them, and replaced with a single SelectItem that handles both multiple and single selection cases. SelectItem sounds more unambiguous to me.
Ok, I think, this is a good idea.
Fred
You guys are, "On it Boss"
Thanks,
Jim