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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListCtrl

Status
Not open for further replies.

raochetan

Programmer
Aug 20, 2001
62
IN
I have inserted a few items in the List Control and provided functionality to move the items up and down the list by press of 2 buttons. I want these button to be enabled or disabled when i select an item using mouse or go through the list using the arrow keys, using the following rules:

1. If the first items is currently selected, only UP button should be disabled.

2. If the last item is currently selected, only DOWN button should be disabled.

3. Otherwise both the buttons should be enabled

Can any one tell me how to do this. I tried with NM_CLICK event on List control, it works on mouse clicks. But every time i have to click the specifed item. If use the arrow keys, there is no change in the buttons.

Thanks in advance

raochetan
 
Use PreTranslateMessage on the CDialog-based class that uses the ListCtrl, check for WM_KEYDOWN message & call the same code as the mouse click when the relevant keystrokes are made Spencer Window (not a joke name)
spencer.window@eastmidlandcomputers.ltd.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top