Solved

Selecting an Item from a list using OnLButtonDown

Posted on 2002-06-24
4
276 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
ID: 7105513
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
ID: 7109390
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
ID: 7110626
Thank you DanRollins, I appreciate the help.
0
 

Accepted Solution

by:
ComTech earned 0 total points
ID: 7110942
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.

Question has a verified solution.

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

Suggested Solutions

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

856 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