selection and drag

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

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

selection and drag

Post by tal » Mon Feb 22, 2010 2:32 pm

Hi,

i want to unselect an object chen the object is selected so i do :

Code: Select all


on selectedObjectChanged   

set the selected of me to false

end selectedObjectChanged

It works when i cilck on the object with the pointer tool, but if i do a drag around the object, the selection remains even if the object is not selected for revolution ( the selectedobjects is empty)

Have you got an idea about this problem?

Thanks

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: selection and drag

Post by Klaus » Mon Feb 22, 2010 4:18 pm

i Tal,

sorry, I don't have the slightest idea what you are trying to achieve?!
Select or not select? :)


Best

Klaus

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

Re: selection and drag

Post by tal » Mon Feb 22, 2010 4:29 pm

lol I want to select the object and then deselect it automaticly( using the handler "on selectedobjectchanged"), like i said it works with a simple click on the object but doesnt work when i surround the object.
It is a bit difficult to imaginate, but if you test it you will see the problem i think.

thanks

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: selection and drag

Post by dunbarx » Mon Feb 22, 2010 4:48 pm

tal.

I have posted an inquiry to the mail list, It seems like a bug.

Craig Newman

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: selection and drag

Post by Klaus » Mon Feb 22, 2010 4:52 pm

Ah, oh, hmm, erm, well... :lol:

OK, where did you put your script "on selectionchanged"?
You could also try:

Code: Select all

on selectionchanged
  select empty
end selectionchanged
On the other hand, in the IDE this is "automatic" behaviour:
If you select an object the previously selectewd object gets de-selected unless you hold the SHIFT key, or what am I missing?


Best

Klaus

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

Re: selection and drag

Post by tal » Mon Feb 22, 2010 5:01 pm

I put the "on selectionchanged" in the script of the group i want to select.
"put empty" or "set the selected of me to false" is the same, the both work only in the following case :

I surround the objects with pointer tool, if you do that you will see the selection remains.

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

Re: selection and drag

Post by tal » Mon Feb 22, 2010 5:03 pm

i wanted to say the both usually work but dont work in the following case : ( see previous post)

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

Re: selection and drag

Post by tal » Mon Feb 22, 2010 5:06 pm

To help you understand :

You have to way to select an object manually :
1- Click on it with the pointer tool
2- Surround the objects you want to select with the pointer tool.

Ih the case 2, there is a problem.

Thank you

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: selection and drag

Post by FourthWorld » Mon Feb 22, 2010 5:21 pm

A simpler and more reliable method of preventing an object from being
selected is to turn on the object's cantSelect property.

If you want to allow selection of the group object only but not the objects within it, you can turn off the group's selectGroupedControls property.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: selection and drag

Post by tal » Mon Feb 22, 2010 5:49 pm

Thanks but I want to select the object in the first time and after deselect it automaticly.
In my fonction :

1-The user choose the objects he wants to, by selecting them using the pointer tool.( Click on it or surround objects)
2- So i have a list of objects the user chose
3- I can perform an action on them.

My problem is that the selection is not great visually so i want to deselect them after the user chose the objects but only when i surround objects wth the pointer tool the deselection dosent work, to be more accurate : the deselection works but not visually : i see the selection even if the object is not selected.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: selection and drag

Post by FourthWorld » Mon Feb 22, 2010 8:20 pm

> i see the selection even if the object is not selected.

Have you verified that it's drawing selection handles on objects not included in the selectedObjects?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: selection and drag

Post by tal » Mon Feb 22, 2010 8:56 pm

How can I verifiy this?

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

Re: selection and drag

Post by bn » Mon Feb 22, 2010 10:16 pm

tal,
if I understand you correctly then you have a group or a couple of groups. In each group there is a handler for "selectedObjectChanged". You let the user select the object/s and you want to do something via script to the objects but the selectionhandles should not be visible.
If that is correct then you might try this

Code: Select all

on selelectedobjectchanged
  -- do your code here
   if "unselectMe" is not in the pendingmessages then
      send "unselectMe" to me in 100 milliseconds -- change this interval
   end if
end selectedobjectchanged

on UnselectMe
   select empty
end UnselectMe
this will unselect a group that has been selected by dragging with to pointer tool.
You could also move the "UnselectMe" handler out of the groups and put it on the card script level
regards
Bernd

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: selection and drag

Post by FourthWorld » Mon Feb 22, 2010 10:40 pm

tal wrote:How can I verifiy this?
By putting "the selectedObject" to return a list of the currently-selected object. If you see anything missing from that list that appears in a selected state on screen, you've found a bug.

If not, you may have to decide what you want to do, whether you want your users to be able to select objects or not. It may be confusing to some to select an object only to have it become unselected; no other apps work that way, so even if it's what you intended it will feel to the user like an unstable behavior.

If you want to allow the users to select some controls but not others, try the cantSelect property. If you want them to select a group but not its contents, try the selectGroupedControls.

If neither of these do what you want, please provide a little more background and I'm sure we can come up with something that will serve you and your users well.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: selection and drag

Post by tal » Mon Feb 22, 2010 11:55 pm

Thank yo all, bn i try your solution tomorrow, fourthworld it seems that i have found a bug cause the selectedobjects is empty.

See you

Post Reply