Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Selecting an Item from a list using OnLButtonDown

Posted on 2002-06-24
4
Medium Priority
?
280 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

Technology Partners: 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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

721 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