Solved

CStatic Drag and Drop

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now