choose multiple controls?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
choose multiple controls?
Hello, not sure how to explain this in english, i want the user to be able to choose multiple controls on a stack and then move them alltogether, like when you click hold on an empty area on desktop and drag it to choose whatever you want... is this possible in livecode?
			
			
									
									Knowledge is meant to be shared.
						Re: choose multiple controls?
Hi.
You can always group the controls in question, and then move the group. If the members of the group change, you can ungroup and regroup as needed
It is also possible to move several controls using a repeat loop. (pseudo):
Craig Newman
			
			
									
									
						You can always group the controls in question, and then move the group. If the members of the group change, you can ungroup and regroup as needed
It is also possible to move several controls using a repeat loop. (pseudo):
Code: Select all
repeat 10
lock screen
set the left of control 1 to the left of control 1 + 1
set the left of control 2 to the left of control 2 + 1
set the left of control 3 to the left of control 3 + 1
unlock screen
end repeatRe: choose multiple controls?
hey dunbarx, thank you for your answer, my problem isnt how to move the controls, my problem is how the user will choose the controls see the image below to uderstand
			
							
			
									
									Knowledge is meant to be shared.
						- 
				FourthWorld
- VIP Livecode Opensource Backer 
- Posts: 10065
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: choose multiple controls?
That layout seems a good fit for the DataGrid, which can handle multiple selections in custom list layouts quite well.
			
			
									
									Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
						LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: choose multiple controls?
If I understand, try this. place a few buttons and one field on a card. In the card script:
Now this is bare bones,but shows how you can select several controls and store that information.
How to initiate, how to terminate the selecting sequence and then process, how to reset, etc. are all issues to be resolved. But is this enough of a head start to get you going? Write back if I still do not know what you mean, or if I do, what other help you might need.
Craig
			
			
													Code: Select all
on mouseUp
      put the mouseControl & return after fld 1
end mouseUpHow to initiate, how to terminate the selecting sequence and then process, how to reset, etc. are all issues to be resolved. But is this enough of a head start to get you going? Write back if I still do not know what you mean, or if I do, what other help you might need.
Craig
					Last edited by dunbarx on Sun Jan 11, 2015 6:08 am, edited 2 times in total.
									
			
									
						Re: choose multiple controls?
I think this heavily commented code is more along the lines;
Now that is occasionally working  
Its more for Craig to look at.
In short
find the locations of the controls
is the location of any of the controls within the drag area
group the controls that are
grab the group
Bet you someone has a 1 liner for this 
 
Simon
Edit; Oh wait.... Craig already knows this.
			
			
									
									Code: Select all
local tStart,tEnd,tControl,tLoc
on mouseDown
   if there is a last group then
      ungroup the last group
   end if
   put "" into tLoc
   put the number of controls of this cd into tControl
   repeat with x = 1 to tControl
      put the loc of control x  & comma & the id of control x & cr after tLoc
   end repeat
   put the mouseLoc into tStart
end mouseDown
on mouseUp
   put the mouseLoc into tEnd
   repeat for each line tLine in tLoc
      if item 1 of tline >= item 1 of tStart and item 1 of tLine <= item 1 of tEnd then
         if item 2 of tline >= item 2 of tStart and item 2 of tLine <= item 2 of tEnd then
            put "control id" && item 3 of tLine && "and " after tName
         end if
      end if
   end repeat
   if tName = "" then exit to top
   delete the last word of tName
   do "group" && tName
   set the script of the last group to "on mouseDown" & cr & \
"grab me" & cr & \
"end mouseDown" 
end mouseUp
Its more for Craig to look at.
In short
find the locations of the controls
is the location of any of the controls within the drag area
group the controls that are
grab the group
Bet you someone has a 1 liner for this
 
 Simon
Edit; Oh wait.... Craig already knows this.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
						Re: choose multiple controls?
Thanks alot guys, you gave me a place to start from 
			
			
									
									
Knowledge is meant to be shared.