Hi.
That was Klaus, not me.
Now then, you wrote:
once for each control, which is not really elegant
But you can pass any number of parameters along with a message. Got some spare time? Make three buttons on card 1 of your mainStack. Label them "A", "B", and "C". It would be nice to have some other buttons as well. In the mainStack script:
Code: Select all
on testMessage a,b,c
repeat with y = 1 to the paramCount --paramCount is "3"
put the loc of btn param(y) of stack (the mainstack of this stack) & return after accum
--param(y) is the current parameter. Param(2) is "b"
end repeat
answer accum
end testMessage
In a button on your subStack:
Code: Select all
on mouseup
testMessage "A","B","C"
end mouseup
Now perhaps this has a couple of unfamiliar terms, such as "param" and "paramCount". But you can see that a message can pass parameters along with it, that can be acted upon in a remote stack. Note that the "mainStack of this stack" is very useful, since you might have multiple subStacks, and this function will always finds the mother ship.
The handler will remotely find the "A", "B" and "C" buttons among others, and return their locs.
And the real lesson is that you must still explicitly designate the mainStack, or LC will throw an error, not knowing where those buttons are.
Craig