Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

Selecting an Item from a list using OnLButtonDown

I'm trying to use drag and drop with a List Control.  When I press the left mouse button down it automatically goes to my OnLButtonDown fuction.  How can I get it to select the item first and then continue on with my function?  If I right click on the item first (highlighting item), and then start the drag it works.  Any ideas?
0
jeremy630
Asked:
jeremy630
  • 2
1 Solution
 
jeremy630Author Commented:
I found out what I was doing wrong.  I needed to get rid of the OnLButtonDown function first.  I move everything from that to a function I created.  Then in my OnChildNotify which is constantly checking for system functions being performed (such as right clicks, key down, etc...) I added another or to this code:

if (((NMHDR*)lParam)->code == NM_CLICK || ((NMHDR*)lParam)->code == NM_RCLICK || ((NMHDR*)lParam)->code == LVN_BEGINDRAG)

After this followed something coded previously for the NM_CLICK and NM_RCLICK which selected the item like I needed it to do.  I followed that up with:


if (((NMHDR*)lParam)->code == LVN_BEGINDRAG)
{
     LeftButtonDown(); //The function I created
}

This worked perfectly!

I tried doing the same exact thing except I was trying to use NM_LDOWN.  This was defined in the same header as NM_CLICK, NM_RCLICK, and LVN_BEGINDRAG, but for some reason it kept giving me this error:

error C2065: 'NM_LDOWN' : undeclared identifier

I don't know why it was doing this and I don't care because it is working now.

Thank you anyway to anyone who was going to help.  

Now I just need to figure out what steps I need to take to close this question.    
0
 
DanRollinsCommented:
post a message to Community support and treference the Q number of this question.  It is:

     Q_20315541

use this link:
     http://www.experts-exchange.com/jsp/qAskQuestion.jsp?ta=commspt

Ask them to delete the question and refund your points.

- Dan
0
 
jeremy630Author Commented:
Thank you DanRollins, I appreciate the help.
0
 
ComTechCommented:
Placing this question into PAQ, as it has both a question and an answer.

Kind regards,
ComTech
CS @ EE
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now