?
Solved

How to get the cursor position in ListControl

Posted on 2005-03-05
5
Medium Priority
?
221 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

764 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