Dragging a box with mouse?
Anyone know how to how i can go about this? In some application you can click and drag a box out with your mouse, like you can on your desktop to select icons.
Im wanting something like that in my app and well... i seem to be going a very long way around it and im sure there must be an easier way?
Cheers
Andy
Re: Dragging a box with mouse?
Use the Overlay object to load a 1X1 pixel BMP (or set a colour of your choice) and make it semi-transparent.
When you click position the top left of the overlay at mouse X,Y then while the mouse is clicked set the bottom left of the overlay object to mouse X,Y. It's a neat effect. Try it.
Re: Dragging a box with mouse?
Yea sounds like that would work but i cant find anywhere to position the top left and bottom left ETC? you can position in the frame, or simply resize it?
Cheers
Andy
Re: Dragging a box with mouse?
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=41543&page=0#Po st41543
There you go, made an example for ya!
Re: Dragging a box with mouse?
Re: Dragging a box with mouse?
I wouldn't recommend using the overlay object for that.
Active Objects are way faster for that kind of thing, but a better (faster) approach would be to use two instances of two active objects. One object for the line at the top/bottom and one for the line at the left/right. You can make the actives 1x1 in size and then scale them to get the size you want. Then your objects don't cover a large area so objects beneath the "rectangle" you cover aren't forced to redraw.
It's a little tricky but maybe worth the effort if you find that the other approach is slowing down your game.
Re: Dragging a box with mouse?
The active picture object won't use minus values though. DingDong, that was QUICK! Ahhh active system box good idea!
Re: Dragging a box with mouse?
i think from memory I used an active system box. Just make the body transparent and change the border to whatever colour you want and it will give you a similar effect.
Then I had two little 'dots', one which goes to mouse position when user clicks, then another which always follows mouse co-ordinates. Then I simply resized the system box between the 2 points and viola.
Its just a matter of adding a few lines of code in the detect where the mouse is in relation to the original click point to resize the box accordingly. ie: if X 'click dot' > X 'mouse dot' then set position of system box' to X 'mouse dot' and resize between the two points.
Hope this makes sense. Im at work so can't make an example right now!