trash bin like feature
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
trash bin like feature
I've been trying to implement a recycle bin like feature. I've been trying to do this by detecting if there are images within a field however, i cant seem to work out the problems.
Re: trash bin like feature
Hi demolken,
I don't have the slightest idea what you are talking about resp. what you are trying to achieve!?
Best
Klaus
I don't have the slightest idea what you are talking about resp. what you are trying to achieve!?
Best
Klaus
Re: trash bin like feature
Klaus- not to worry. I think it's just another spam message.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: trash bin like feature
This seems like a reasonable request, and a reasonable approach to finding a solution, detecting whether one object is within the rect of another.
Only a single post, but why think it is bogus? If spam, it is very well done in a LC context. We need the algorithms that produced it.
So Demolken, are you for real?
Craig Newman
Only a single post, but why think it is bogus? If spam, it is very well done in a LC context. We need the algorithms that produced it.
So Demolken, are you for real?
Craig Newman
Re: trash bin like feature
yes i'm real. Sorry for the difficult explanation but craig seems to have answered my question. Thank you
Re: trash bin like feature
Hi Demolken,
AHA!
OK, welcome to the forum!
Best
Klaus
AHA!

OK, welcome to the forum!
Best
Klaus
Re: trash bin like feature
Yay! on all counts. 

PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: trash bin like feature
Goodie.
And Demolken, since you appear to be well on your way with the "within" function, which pertains to objects, do also look at the "is within" operator, which is similar, but pertains to points.
If you intend to animate your trashcan gizmo, please demonstrate it here.
Craig Newman
And Demolken, since you appear to be well on your way with the "within" function, which pertains to objects, do also look at the "is within" operator, which is similar, but pertains to points.
If you intend to animate your trashcan gizmo, please demonstrate it here.
Craig Newman
Re: trash bin like feature
I was thinking about this, and thought I was presumptuous
I made two buttons. In the script of the first one (the button to be trashed) I put:
This uses the "is within" operator as opposed to the "within" function that I assumed earlier. You may be well ahead of this already.
Craig Newman
I made two buttons. In the script of the first one (the button to be trashed) I put:
Code: Select all
on mouseMove
if the mouse is down then set the loc of me to the mouseLoc
end mouseMove
on mouseup
if the loc of me is within the rect of btn "trashCan" then put random(99)
end mouseup
Craig Newman
Re: trash bin like feature
Hi friends,
watch out!
"Polling" the mouse in this way is SIN and will lead to eternal damnation:
http://www.hyperactivesw.com/resources_polling.html
Best do this instead "on mousemove":
Best
Klaus
watch out!
Code: Select all
on mouseMove
if the mouse is down then set the loc of me to the mouseLoc
end mouseMove
http://www.hyperactivesw.com/resources_polling.html

Best do this instead "on mousemove":
Code: Select all
on mousedown
grab me
end mousedown
Klaus
Re: trash bin like feature
Klaus.
Yep, grab is better. More relaxing to the engine.
But polling, when an action is wholly dedicated to a particular task, does not seem to me to be so dastardly. Certainly if any other task at all might be running at the same time, or might be called or invoked during that action, then a "send in time" or somesuch is proper.
Still does not mean that "grab" is not better.
Craig
Yep, grab is better. More relaxing to the engine.
But polling, when an action is wholly dedicated to a particular task, does not seem to me to be so dastardly. Certainly if any other task at all might be running at the same time, or might be called or invoked during that action, then a "send in time" or somesuch is proper.
Still does not mean that "grab" is not better.
Craig
Re: trash bin like feature
If it only involved LiveCode itself then you're right. The problem is, though, that it stops the whole computer. All background tasks in all open apps, including the OS, are suspended or at least greatly slowed down. Dr Raney's pet peeve with this (he was the original damnation-caster) was that every other app came to a halt while the tight polling loop used almost 100% of the CPU.dunbarx wrote: But polling, when an action is wholly dedicated to a particular task, does not seem to me to be so dastardly. Certainly if any other task at all might be running at the same time, or might be called or invoked during that action, then a "send in time" or somesuch is proper.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: trash bin like feature
Jacque.
I watched the "Activity Monitor" while this was running:
I could be completely misreading this application, but whereas when nothing was going on in LC, CPU usage was about 17%. During the actual mouseMove action, activity dropped to about 10%, and sometimes lower. In other words, to free up the CPU, run a CPU intensive process.
About the same response using "grab", by the way.
Macbook Air, 1.86 GHz.
Craig
I watched the "Activity Monitor" while this was running:
Code: Select all
on mouseMove
if the mouse is down then set the loc of me to the mouseLoc
end mouseMove
About the same response using "grab", by the way.
Macbook Air, 1.86 GHz.
Craig
Re: trash bin like feature
Based on the linked page, checking things in the mousemove is the "recommended" method. The linked page rather says the following is bad.
This isn't polling, its just a message being handled and should work great.
Code: Select all
repeat until the mouse is up
set the loc of btn "dragBtn" to the mouseLoc
end repeat
This isn't polling, its just a message being handled and should work great.
Code: Select all
on mouseMove
if the mouse is down then set the loc of me to the mouseLoc
end mouseMove
Re: trash bin like feature
Does it matter if you use the "intersect" function, "is within" or the "within" function for testing if the object is in the trashcan?
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/