Home » Community » Newbie corner » Drag & Drop box
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: Sun Jul 13 23:15:45 CEST 2025
Total time taken to generate the page: 0.04027 seconds
|