Solved

Selecting an Item from a list using OnLButtonDown

Posted on 2002-06-24
4
279 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
[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
  • 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

Industry Leaders: 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 This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

615 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