Am 16.03.2011 03:11, schrieb Pasquale Rinaldi:
I have 2 listview's on a window/view. the idea is to use them to move items back and forth between the listviews. I can do that part fine. My issue is more user interface like. I'll call the listview's leftlist and rightlist. what i want is the following: 0. no items are selected in either list when the window loads 1. select an item from leftlist - it is highlighted (works as expected) 2. select an item from rightlist - it is highlighted and then deselect the item from leftlist 3. select an item from leftlist - it is highlighted and then deselect the item from rightlist okay, so when an item in leftlist is selected, i use rightlist->deselectall() to deselect the item. when an item in rightlist is selected, i use leftlist->deselectall() to deselect the item. when both deselect commands are used, one in leftlist and one in rightlist, clicking between the lists will deselect the corresponding item, select the correct item, but will not highlight the correct item as it should do. if i only have one deselect command in one of the lists, then when you click the list, the correct item is deselected, the correct item is selected and that item is highlighted as expected. why if two listviews each have a deselect for the other listview in the function when an item in the respective listview is selected, does it not highlight the item as it should? is this a bug in blistview? is there anyway i can find out if there is an error or something that would let me know if it is a bug, the program functions properly minus the highlighting aspect? any help would be greatly appreciated to explain or help resolve this highlighting issue with blistviews.
If you inserted your code in the SelectionChanged() hook method of the BListView class, you need to check whether there is any selection at all. SelectionChanged() is called, as the name implies, whenever the selection changes, so also when everything is deselected, hence your cycle. You can check for the existance of a selected item by using CurrentSelection(0). If it returns -1, then no item is selected. This will break your cycle:
void YourListView::SelectionChanged() { if (CurrentSelection(0) >= 0) otherListView->DeselectAll(); } Best regards, -Stephan