Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to get the cursor position in ListControl

Posted on 2005-03-05
5
Medium Priority
?
223 Views
Last Modified: 2013-11-20
Hi there,

I need to get the row index when an item is clicked on a ListControl.  For example, in ListBox there is a function
GetCurSel( ) to get the selected row.  But, how can I get the row index in a ListControl.

Thanks,

0
Comment
Question by:thanesh
  • 3
5 Comments
 
LVL 1

Author Comment

by:thanesh
ID: 13469064
I have used the LVS_EX_FULLROWSELECT style to select the entire row when an item is clicked.  I just need the row index so that I can display some related data for that particular index in another window.
0
 
LVL 4

Expert Comment

by:sgvill
ID: 13469185
Is ListControl.SelectedIndex what you are looking for?
0
 
LVL 1

Author Comment

by:thanesh
ID: 13469231
Hi Sgvill,

I could not find a member function named SelectedIndex for the ListControl.  I found an examle where they calculate the selected index based on GetTopIndex() and GetCoutPerPage()... but there is a bug in that example that I am trying to understand.  Please let me know if there is an easy way.  Thanks.
0
 
LVL 9

Accepted Solution

by:
Priyesh earned 200 total points
ID: 13469313
     int nItem = m_list.GetNextItem(-1, LVNI_SELECTED) ;
0
 
LVL 1

Author Comment

by:thanesh
ID: 13469324
Thank you. :-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question