Cooper,
you can get this to work if in the mouseUp handler of button "Test" you put:
Code: Select all
on mouseUp pWhat
put name of (pWhat)
end mouseUp
You provide the variable in the receiving button pWhat which you can then process. BUT this is not a good idea since if you click at button "Test" the system will send a parameter for the kind of click, a left-click is 1 for example. Now your script can not resolve the name of 1, you get an error.
The bottom line is if you send a paramter to an object the receiving object must have a variable(s) that accepts the parameter(s). Or you could look at the params function, but that is complicated in my opinion and unnecessary in such a case.
If in button test you would define a command
Code: Select all
on SendMeSome pWhat
put name of (pWhat)
mouseUp -- this is optional in case you want to trigger the mouseUp message
end SendMeSome
you have a less ambiguous situation.
Button otherButton would then send
Code: Select all
on mouseUp
dispatch "sendMeSome" to btn "test" with the long id of btn "otherButton"
end mouseUp
@ ShadowSlash
I try to avoid global variables as they are hard to handle since every open stack can access them and one tends to go into naming conventions for oneself that inadvertently declare a global in a different contexts, debugging that is a pain. I much prefer script local variables or custom properties. They are much "cleaner" since their scope is narrower or more precise. I use global variables only if I can not avoid them and up to now I did not need them in Rev. In Hypercard I had to use them and that is where I learned to very careful with them. There is a reason that Dunbarx warned against the use of them. At first they seem very handy but in the long run problems show up.
regards
Bernd