select objects and drag them around

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

select objects and drag them around

Post by bn » Thu Feb 25, 2010 2:54 pm

Out of a thread which grew very long I post this as an answer to Tal.
(http://forums.runrev.com/phpBB2/viewtop ... f=9&t=4917)
It is a stack that lets you select objects (groups with 1 button in it as it is) and you can drag them around. Shift clicking selects/deselects.
Script in the card script. This version implements the dragging part and respects the boundaries of the card (no accidental moving of objects off the card)
Should be easily adaptable to different scenarios.
regards
Bernd
Attachments
selectGroupsIIII.rev.zip
(5.96 KiB) Downloaded 270 times

tal
Posts: 84
Joined: Thu Jul 02, 2009 3:27 pm

Re: select objects and drag them around

Post by tal » Mon Mar 01, 2010 3:26 pm

Hi bn,

I succeed with solution, it is very helpful, thank you.

See you soon for the next problem lol

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: select objects and drag them around

Post by jmburnod » Mon Mar 01, 2010 5:54 pm

Hi Bernd,

Very clever. Thanks

• I suggest an alert if btns have scripts or suppress the selection by mouseup with shiftKey

• I'm a little bit confuse with the make group command. At first I thinked it group the current selection ( i haven't really readed the "create/delete groups" comment :( )
• Be careful, if the user change the loc of group 1 the command can create some group without the rect of stack

Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: select objects and drag them around

Post by bn » Mon Mar 01, 2010 7:17 pm

Merci Jean-Marc,
jmburnod wrote:• I suggest an alert if btns have scripts or suppress the selection by mouseup with shiftKey
you could put

Code: Select all

on mouseUp
   if the hilite of btn "bMakeSelection" then pass mouseUp

   -- rest of code here
end mouseUp

on mouseDown
   if the hilite of btn "bMakeSelection" then pass mouseDown
 
     -- rest of code here
end mouseDown
into the buttons (just delete all but the last group with the "DeleteGroups" button and put this script into the button, add your code for normal mouseUp/Down
jmburnod wrote:• I'm a little bit confuse with the make group command. At first I thinked it group the current selection
I left the "MakeGroups" / "DeleteGroups" buttons in the stack as a convenient way to change the one Button/Group that is cloned, they have zero errorchecking since they are only for development.
jmburnod wrote:• Be careful, if the user change the loc of group 1 the command can create some group without the rect of stack
Same here, just for development, no errorchecking.

regards
Bernd

Post Reply