U++ framework
Do not panic. Ask here before giving up.

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 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1796
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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: real size of window
Next Topic: Basic question regarding callbacks
Goto Forum:
  


Current Time: Sun Sep 13 05:31:30 GMT+2 2026

Total time taken to generate the page: 0.00888 seconds