Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LVIS_FOCUSED and LVIS_SELECTED

Status
Not open for further replies.

Valius

Programmer
Oct 20, 2000
174
US
I've got a really weird thing going on here....Based on an event that happens (a call comes in), I highlight that current call using:

MyListCtrl->SetItemState(0, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);

Well, when I check to see the state of the selected/focused item in my ListCtrl I get a 2 back for LVIS_SELECTED!!. I do get a 1 back for my LVIS_FOCUSED. Well, when I tell my app to pick up the call using MyListCtrl->GetSelectionMark(), it's not grabbin the right one eventhought I told it which call to selected and focus on. What does a 2 mean? a 1 sets the bits and a 0 clears the bits...right? How can I get it to actually SET it. I do have my ListCtrl to display the selected item at all times...could this be my problem? Any and all info is GREATLY appreciated. Thanks in advance.

Niky Williams
NTS Marketing
 
hello,

If You Use GetItemState (nItem, nState, nStateMask) the return value is the state of the item / subitem. If you set the state LVIS_SELECTED | LVIS_FOCUSED you should get the value 3 (LVIS_SELECTED = 2 and LVIS_FOCUSED = 1). Use lvItem.State & LVIS_FOCUSED or lvItem.State & LVIS_SELECTED to see if the state is set.

SetItemState uses the second parameter (nState) as the value to be set. the nStateMask is used to indicate wich state to set it to. So
SetItemState (nItem, LVIS_SELECTED, LVIS_SELECTED), will add the selected state to the item.
SetItemState (nItem, LVIS_FOCUSED, LVIS_FOCUSED) will add the FOCUSED state.

grtz Pierre.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top