Fwd: Quantum tunneling in LiveCode
stgoldberg at aol.com
stgoldberg at aol.com
Tue Mar 3 07:31:15 EST 2015
The issue of a background group being in two places at once is not quite clarified. Getting back to the script sequence below, when there is a mouseUp handler in a background group, the message, on clicking on the grouped button goes from:
button --> group --> card --> stack
When clicking on the card the message goes from:
card --> group --> stack
In effect the group acts on both sides of the card depending on where you click. So is mistaken to think that as soon as a background group is formed it mysteriously picks up and moves from one side of the card to the other (spreading out as it does so). It in effect remains on both sides, as seen by the message sequence when clicking on the button.
I think the practicality of this discussion is in the situation where one wants, say, a cluster of buttons to appear on all cards in a stack, so one makes the button cluster a background group. If the background group has a mouseUp handler, its script will confusingly be enacted not only when clicking on the buttons but also wherever one clicks on the card. I think the bottom line is to be cautious about putting mouseUp scripts in background groups, or to put a disclaimer in the group at the beginning of the group handler the line (as mentioned in the User Manual (pg 131, 5.3.9):
if the owner of the target is not me then pass mouseUp
Stephen Goldberg
www.medmaster.net
-----Original Message-----
From: stgoldberg <stgoldberg at aol.com>
To: use-livecode <use-livecode at lists.runrev.com>
Sent: Mon, Mar 2, 2015 4:07 pm
Subject: Quantum tunneling in LiveCode
In quantum mechanics something can be in more than one place at once. A paradox of sorts seems to occur in the message chain with groups in LiveCode. Try this:
1. Place a button on a card.
2. Make the button a group. Set the group's backgroundBehavior to true.
3. Place the following script in the button:
on mouseUp
answer "I am a button"
pass mouseUp
end mouseUp
4. Place the following script in the group:
on mouseUp
answer "I am a strange group"
pass mouseUp
end mouseUp
5. On the card script write:
on mouseUp
answer "I am a card"
pass mouseUp
end mouseUp
6. In the stack script write:
on mouseUp
answer "I am a stack"
end mouseUp
7. Now click on the button. You get the sequence:
I am a button --> I am a strange group --> I am a card --> I am a stack
8. Now click on the card. You get:
I am a card --> I am a strange group --> I am a stack
Where is the strange group, before or after the card?
Stephen Goldberg
www.medmaster.net
More information about the use-livecode
mailing list