Good night see you
selection and drag
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: selection and drag
fourthworld, I want to unselect it cause I dont like the visual aspect of the selection, after unselecting it I will select it with a borderwidth or a backgroundcolor...
Good night see you
Good night see you
-
FourthWorld
- VIP Livecode Opensource Backer

- Posts: 10070
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: selection and drag
If your goal is to find obscure bugs, rest assured there are many.
But if your goal is to deliver a good user experience with your software, a little more feedback on what you're looking to do will help us help you find a winning solution.
But if your goal is to deliver a good user experience with your software, a little more feedback on what you're looking to do will help us help you find a winning solution.
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: selection and drag
Thanks bn your solution works.
I want to design my selection, if the object is selected, it is red, if it is not selected it is gray.
So the problem now is that the object is red and after a time it becomes gray, it is because the handler is called 2 times during the same selection :
I want to design my selection, if the object is selected, it is red, if it is not selected it is gray.
So the problem now is that the object is red and after a time it becomes gray, it is because the handler is called 2 times during the same selection :
Code: Select all
on selectedObjectChanged
-- do your code here
if "unselectMe" is not in the pendingmessages then
if the objselect of me is true then
set the backgroundcolor of btn 1 of me to "gray"
set the objselect of me to false
send "unselectMe" to me in 100 milliseconds -- change this interval
else if the objselect of me is false then
set the backgroundcolor of btn 1 of me to "red"
set the objselect of me to true
send "unselectMe" to me in 1000milliseconds -- change this interval
end if
--send "unselectMe" to me in 100 milliseconds -- change this interval
else
end if
end "selectedObjectChanged"
on UnselectMe
set the selected of me to false
end UnselectMe
Re: selection and drag
Tal,
try this in the script of every group you want to be hilited/unhilited. It assumes at least one button in each group.As Richard pointed out, may be you should rethink your user interface. But without knowing your application it is difficult to tell.
regards
Bernd
try this in the script of every group you want to be hilited/unhilited. It assumes at least one button in each group.
Code: Select all
on selectedObjectChanged
-- do your code here
if the long id of me is in the selectedObjects then -- is only on select, not on unselect
if the objselect of me is true then
set the backgroundcolor of btn 1 of me to "gray"
set the objselect of me to false
send "unselectMe" to me in 10 milliseconds -- change this interval
else
set the backgroundcolor of btn 1 of me to "red"
set the objselect of me to true
send "unselectMe" to me in 10 milliseconds -- change this interval
end if
end if
end "selectedObjectChanged"
on UnselectMe
set the selected of me to false
end UnselectMeregards
Bernd
Re: selection and drag
Thank you all , it works fine.
Re: selection and drag
It is me again lol sorry if i have a lot of questions, so the solution of bn works but I have a lot of objects on the screen, if i surround them, not all of them will be selected, this problem comes from the laps of time maybe?
thank you
thank you
Re: selection and drag
tal,
I tried it with 50 groups. It is a little slow but works.
I attach the teststack for you to check.
regards
Bernd
I tried it with 50 groups. It is a little slow but works.
I attach the teststack for you to check.
regards
Bernd
- Attachments
-
- selectGroups.rev.zip
- (2.82 KiB) Downloaded 262 times
Re: selection and drag
I have run this back and forth on the mail list.
The issue Tal raises is that when selecting an object by dragging a selection rectangle, as opposed to simply clicking on an object with the pointer, the handles linger after deselecting. The object really is deselected (the selectedObjects returns empty), but the handles linger.
One can "really" re-select the object in the usual ways, and the object's border will hilite. But the handles remain regardless; they are stuck to the object.
It does not even matter if the script is deleted. If the drag is performed with the script intact, the handles linger.
It goes beyond this. Once you have an object in this state, it is possible to move any other selected object by clicking and dragging within the rect of the oddball object, as if that rect were mapped to the rect of the object you are moving. Weird.
Craig Newman
The issue Tal raises is that when selecting an object by dragging a selection rectangle, as opposed to simply clicking on an object with the pointer, the handles linger after deselecting. The object really is deselected (the selectedObjects returns empty), but the handles linger.
One can "really" re-select the object in the usual ways, and the object's border will hilite. But the handles remain regardless; they are stuck to the object.
It does not even matter if the script is deleted. If the drag is performed with the script intact, the handles linger.
It goes beyond this. Once you have an object in this state, it is possible to move any other selected object by clicking and dragging within the rect of the oddball object, as if that rect were mapped to the rect of the object you are moving. Weird.
Craig Newman
Re: selection and drag
Although I see much progress has been made, I’ll post what I have done as a matter of interest. I gather that the requirement is that, although using the pointer tool to make selections, the number and size of objects in this case makes the standard selection “handles” look cluttered and visually unappealing, so the idea is to try another method of highlighting. This is what I glean from various posts. I attach a test stack, the work being done in the card script. I conducted early tests with:
or “set the selected of me to false”
... and found it could produce the state described where, after dragging to select several objects, the “handles” would remain visible, even when “the selectedObjects” returned empty. Perhaps some of the difficulty stems from having the handler trigger itself. On receiving a selectedObjectChanged, we have told it to select empty, which triggers another selectedObjectChanged, so it “double fires”. Like Bernd (regards!), I found “send” helpful.
Code: Select all
on selectedObjectChanged
select empty
end selectedObjectChanged... and found it could produce the state described where, after dragging to select several objects, the “handles” would remain visible, even when “the selectedObjects” returned empty. Perhaps some of the difficulty stems from having the handler trigger itself. On receiving a selectedObjectChanged, we have told it to select empty, which triggers another selectedObjectChanged, so it “double fires”. Like Bernd (regards!), I found “send” helpful.
Re: selection and drag
Craig,
from your discussion with tal and on the list I noticed this too, I tried to provide a workaround for Tal which works by sending in time a command to select empty.
Funny thing though is that when you issue a "set the selected of the target to false" in the "selectedObjectChanged" handler the "select empty" with the send in time does not work anymore. See script there is definitely something weird going on.
regards
Bernd
from your discussion with tal and on the list I noticed this too, I tried to provide a workaround for Tal which works by sending in time a command to select empty.
Funny thing though is that when you issue a "set the selected of the target to false" in the "selectedObjectChanged" handler the "select empty" with the send in time does not work anymore. See script
Code: Select all
on selectedObjectChanged
-- handle your selectedObjectChanged here
--
-- set the selected of the target to false -- does not work if this is uncommented
if "unselectMe" is not in the pendingmessages then
send "unselectMe" to me in 2000 milliseconds -- change this interval
end if
--pass selectedObjectChanged -- does not change the outcome if you set the selected of the target to false
end selectedObjectChanged
on unselectMe
select empty
end unselectMeregards
Bernd
-
FourthWorld
- VIP Livecode Opensource Backer

- Posts: 10070
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: selection and drag
Feel free to log the bug at the RQCC so it can get into queue to be fixed:
http://quality.runrev.com/qacenter/
In the meantime, if you're looking for a solution for yourself and your users a little more background on the goal you want to accomplish will help us find a good one for you.
http://quality.runrev.com/qacenter/
In the meantime, if you're looking for a solution for yourself and your users a little more background on the goal you want to accomplish will help us find a good one for you.
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: selection and drag
Hi everyone, i do this cause I want the user to select somes objects and then if a group is moved the other groups selected follow automaticly in the same translation.
So it is for a deplacement of groups.
The bn's solution works, but for my groups, when i surround them, some of them are not selected, maybe it is because my groups contain at least 3 elements? ( not a simple button)
Good night, see you tomorrow
So it is for a deplacement of groups.
The bn's solution works, but for my groups, when i surround them, some of them are not selected, maybe it is because my groups contain at least 3 elements? ( not a simple button)
Good night, see you tomorrow
Re: selection and drag
tal,
I tried a different approach without using the pointer tool in Rev which causes a lot of problems as we have seen.
In this stack you have to click a checkbox button if you want to make a selection. Then you can drag over your groups and a rectangle shows you where you are and the background color of button 1 of each selected group is set to red. Selecting the groups gives you a list of the long ids of the selected groups and you can use this list to move your groups. If you click outside of the groups everything is deselected. Unchecking the checkbox button unselects the groups also. See if this is an approach you can use in your project.
The script is in the card.
I tried a different approach without using the pointer tool in Rev which causes a lot of problems as we have seen.
In this stack you have to click a checkbox button if you want to make a selection. Then you can drag over your groups and a rectangle shows you where you are and the background color of button 1 of each selected group is set to red. Selecting the groups gives you a list of the long ids of the selected groups and you can use this list to move your groups. If you click outside of the groups everything is deselected. Unchecking the checkbox button unselects the groups also. See if this is an approach you can use in your project.
The script is in the card.
- Attachments
-
- selectGroupsII.rev.zip
- (3.48 KiB) Downloaded 295 times
Re: selection and drag
Hi,
Thank you, something like this is exactly what I want, but I have to change this to make it work like the pointer tool :
- A click on an object select it, another click unselect it
- a surrounding selects the objects ( like you did) and if they are already selected it deselects them
Cause I have groups which are very close and with this method I can't really select the object I want and unselect the object I don't want.
Do you think your code can be improved easily? cause this solution is very good.
Thank you.
Thank you, something like this is exactly what I want, but I have to change this to make it work like the pointer tool :
- A click on an object select it, another click unselect it
- a surrounding selects the objects ( like you did) and if they are already selected it deselects them
Cause I have groups which are very close and with this method I can't really select the object I want and unselect the object I don't want.
Do you think your code can be improved easily? cause this solution is very good.
Thank you.
Re: selection and drag
Tal,
I changed the script so you can unselect / select with the shift key.
The only thing that could happen is that you have a mouseDown handler in any of your buttons. Then if you click inside your button the card would not get the mouseDown message and it would not start the card script. But usually buttons only go for the mouseUp message. If you do have handlers with a mouseDown handler you could pass the mouseDown message at the end of your handler and all is well.
regards
Bernd
I changed the script so you can unselect / select with the shift key.
The only thing that could happen is that you have a mouseDown handler in any of your buttons. Then if you click inside your button the card would not get the mouseDown message and it would not start the card script. But usually buttons only go for the mouseUp message. If you do have handlers with a mouseDown handler you could pass the mouseDown message at the end of your handler and all is well.
regards
Bernd
- Attachments
-
- selectGroupsIII.rev.zip
- (3.55 KiB) Downloaded 285 times