Solved

Selecting an Item from a list using OnLButtonDown

Posted on 2002-06-24
4
269 Views
Last Modified: 2010-08-05
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
Comment
Question by:jeremy630
  • 2
4 Comments
 

Author Comment

by:jeremy630
Comment Utility
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
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
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
 

Author Comment

by:jeremy630
Comment Utility
Thank you DanRollins, I appreciate the help.
0
 

Accepted Solution

by:
ComTech earned 0 total points
Comment Utility
Placing this question into PAQ, as it has both a question and an answer.

Kind regards,
ComTech
CS @ EE
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now