Solved

CStatic Drag and Drop

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

634 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