Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CStatic Drag and Drop

Posted on 1998-03-09
4
Medium Priority
?
931 Views
Last Modified: 2013-11-20
I have two CStatic controls . I want tthe text on these controls to be dragged and dropped on the a Push Button (CButton). Does any one know of any way to do this , or give info regarding any Samples etc.
Ramesh
0
Comment
Question by:nramesh30
  • 2
4 Comments
 
LVL 4

Expert Comment

by:jtwine100697
ID: 1316834
  Closest thing that I can think of is an article (with source) for dragging text between CEdit controls.  It should tell you everything you need to know.

   You can find it on www.codeguru.com.  I think it is under the "misc" or "other controls" section.

-=- James.
0
 

Accepted Solution

by:
mpewjg earned 50 total points
ID: 1316835
I think it should work in following ways:
(1). Use WM_LBUTTONDOWN and PtInRect() to check if your mouse is in CStatic window, and use GetDlgItemText to get the text in CStatic.
(2). Use WM_LBUTTONUP and  PtInRect()to make certian it's in CButton and use SetDlgItemText to write the text.

the OLE samples OCLIENT and HIERSVR should be useful for your problem.
0
 

Author Comment

by:nramesh30
ID: 1316836
mpewjg,

I tried your suggestion. I used the following piece of code on OnLButtondown of Dialog class.

CRect rect;
m_staticsource->GetWindowRect(&rect);  (m_staticsource is CStatic *);
if(rect.PtInRect(point)
{
   code

}

'code' does not get executed at all. control does not come inside the if loop.
I even tried changing into Logical points. it doesn't work.
Can uhelp me.

Thankx
0
 

Expert Comment

by:mpewjg
ID: 1316837
rect.PtInRect(point) may failed if the rectangle is not normalized. Thus you can try to use NormalizeRect() to normalize rect before use it.
Hope it work.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

971 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