Home » Community » Newbie corner » Drag & Drop box
|
|
Re: Drag & Drop box [message #26673 is a reply to message #26667] |
Wed, 19 May 2010 09:05 |
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 #26677 is a reply to message #26675] |
Wed, 19 May 2010 10:02 |
|
Hi Rett,
If I understand correctly, you want boxes moveable by user. To achieve this, you have basically two options:- Using single class, probably derived directly from Ctrl, which would draw the boxes in its Paint() function.
- 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
|
|
|
|
|
Goto Forum:
Current Time: Thu Mar 28 12:09:51 CET 2024
Total time taken to generate the page: 0.01040 seconds
|