Solved

CStatic Drag and Drop

Posted on 1998-03-09
4
867 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 92
how do i create updater to My Activex application? 3 88
Process filename extension 3 187
countEvens challenge 2 103
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 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