Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,287 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,289 people online right now. Registration is fast and FREE... Join Now!




dragging and dropping with MFC

 
Reply to this topicStart new topic

dragging and dropping with MFC

didgy58
post 15 Mar, 2008 - 03:42 AM
Post #1


D.I.C Head

**
Joined: 23 Oct, 2007
Posts: 170



Thanked 1 times
My Contributions


hi guys and gals, another quick one here, i have my coil object that is created when i left click onto the view of my program, now this coil take the x and y co-ordinate from the left click and then stores them and with the code i have then draws the coil. this is fine no problem here, what i was thinking is this when i left click over a already drawn coil i then give the user the ability to drag and drop the coil to a new location, to be honest im not quite sure how to do this, would i have to use on mouse move refresh the page with the invalidate->this function like i do when i use the left click like in the code i will show below
CODE


void CCoilsView::OnLButtonDown(UINT nFlags, CPoing point)
{

CCoilsDoc* pDoc= GetDocument();
int d=point.x;
int f=point.y;
temp=CheckCoils2(d,f);
if (temp==-1){
pDoc->n=pDoc->n+1;
CView::OnLButtonDown(nFlags, point);
pDoc->mycoil[pDoc->n-1].x=point.x;
pDoc->mycoil[pDoc->n-1].y=point.y;
pDoc->mycoil[pDoc->n-1].rot=0;
pDoc->mycoil[pDoc->n-1].thicl=2;
this->invalidate();
}
}

now when the invalidate is called ondraw has a function in it which draws the coil for me thats fine so i guess im wondering how would i go about selecting that object and changing the mouse co-ordintates everytime i drag it??? so it redraws as i drag as well?? if you understand what im trying to get to all i need to know is how to be able to change the point.x and point.y on mouse move??? cause i can always call the function again and again cant i??

thanks
dan

This post has been edited by didgy58: 15 Mar, 2008 - 03:47 AM
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/22/08 12:59AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month