Page 1 of 3
selection and drag
Posted: Mon Feb 22, 2010 2:32 pm
by tal
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
Re: selection and drag
Posted: Mon Feb 22, 2010 4:18 pm
by Klaus
i Tal,
sorry, I don't have the slightest idea what you are trying to achieve?!
Select or not select?
Best
Klaus
Re: selection and drag
Posted: Mon Feb 22, 2010 4:29 pm
by tal
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
Re: selection and drag
Posted: Mon Feb 22, 2010 4:48 pm
by dunbarx
tal.
I have posted an inquiry to the mail list, It seems like a bug.
Craig Newman
Re: selection and drag
Posted: Mon Feb 22, 2010 4:52 pm
by Klaus
Ah, oh, hmm, erm, well...
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
Re: selection and drag
Posted: Mon Feb 22, 2010 5:01 pm
by tal
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.
Re: selection and drag
Posted: Mon Feb 22, 2010 5:03 pm
by tal
i wanted to say the both usually work but dont work in the following case : ( see previous post)
Re: selection and drag
Posted: Mon Feb 22, 2010 5:06 pm
by tal
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
Re: selection and drag
Posted: Mon Feb 22, 2010 5:21 pm
by FourthWorld
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.
Re: selection and drag
Posted: Mon Feb 22, 2010 5:49 pm
by tal
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.
Re: selection and drag
Posted: Mon Feb 22, 2010 8:20 pm
by FourthWorld
> 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?
Re: selection and drag
Posted: Mon Feb 22, 2010 8:56 pm
by tal
How can I verifiy this?
Re: selection and drag
Posted: Mon Feb 22, 2010 10:16 pm
by bn
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
Re: selection and drag
Posted: Mon Feb 22, 2010 10:40 pm
by FourthWorld
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.
Re: selection and drag
Posted: Mon Feb 22, 2010 11:55 pm
by tal
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