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
Solved

CStatic Drag and Drop

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ODBC Connection Logging, ADO.NET 6 69
How to determine file rename from EventLog ? 2 55
isEverywhere  challenge 19 82
pre4 challenge 19 103
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 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