Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Drag & Drop box
Drag & Drop box [message #26662] Tue, 18 May 2010 14:59 Go to next message
rett is currently offline  rett
Messages: 15
Registered: January 2010
Promising Member
Hello, how I can create box like Dia ( http://en.wikipedia.org/wiki/Dia_%28software%29 )?

b4b9ef0096f53f85f38f8c84bc5eabec
Re: Drag & Drop box [message #26667 is a reply to message #26662] Tue, 18 May 2010 17:30 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Please specify which box do you mean exactly?
Re: Drag & Drop box [message #26673 is a reply to message #26667] Wed, 19 May 2010 09:05 Go to previous messageGo to next message
rett is currently offline  rett
Messages: 15
Registered: January 2010
Promising Member
Mindtraveller wrote on Tue, 18 May 2010 17:30

Please specify which box do you mean exactly?


For example flowchart elements I can moving it with mouse.


b4b9ef0096f53f85f38f8c84bc5eabec
Re: Drag & Drop box [message #26675 is a reply to message #26673] Wed, 19 May 2010 09:23 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
rett wrote on Wed, 19 May 2010 09:05

Mindtraveller wrote on Tue, 18 May 2010 17:30

Please specify which box do you mean exactly?


For example flowchart elements I can moving it with mouse.


In your program or in the layout editor?

I mean, are you going to do a flowcharting program or you simply wants to show a static flowchart in your program?


Best regards
IƱaki
Re: Drag & Drop box [message #26677 is a reply to message #26675] Wed, 19 May 2010 10:02 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Rett,

If I understand correctly, you want boxes moveable by user. To achieve this, you have basically two options:
  1. Using single class, probably derived directly from Ctrl, which would draw the boxes in its Paint() function.
  2. Having each box as a separate widget. I would take e.g. StaticText a derived the box from that.
In both cases, you can implement the mouse handling inside the LeftDown(), MouseMove() and LeftUp() functions. The idea is: in LeftDown you store position where user clicked, in MouseMove, you calculate the difference between the saved point and current position of mouse pointer and repaint the widget(in 1.)/move the widget(in 2.) and finally in LeftUp you put some cleanup code, like clearing the saved position.

Best regards,
Honza
Re: Drag & Drop box [message #26678 is a reply to message #26677] Wed, 19 May 2010 10:51 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Now I remembered there was already someone solving this problem Smile Have a look at this thread. It might give you some ideas.

Honza
Re: Drag & Drop box [message #26709 is a reply to message #26662] Thu, 20 May 2010 09:41 Go to previous message
rett is currently offline  rett
Messages: 15
Registered: January 2010
Promising Member
I am so grateful for this answer, it really helped me.



b4b9ef0096f53f85f38f8c84bc5eabec
Previous Topic: real size of window
Next Topic: Basic question regarding callbacks
Goto Forum:
  


Current Time: Thu Mar 28 12:09:51 CET 2024

Total time taken to generate the page: 0.01040 seconds