Page 1 of 1
Option buttons can have behavior?
Posted: Mon Apr 07, 2014 11:31 am
by Mag
I try to set a behavior for an option menu and noting seems to happen
Code: Select all
set the behavior of button "chooseAction" to the long id of button "ActionPopup" of card 1 of stack "TM-CodeLibrary"
Also, can't see the behavior field in the Inspector for the Option menu so I suspect that I can't set it... I need to have the same behavior for an option button in two cards and would be great to not to have to repeat the code twice...

Re: Option buttons can have behavior?
Posted: Mon Apr 07, 2014 11:43 am
by Klaus
Hi Mag,
that's how LC works and the syntax is correct!
Enter this in the message box and see what you get:
put the behavior of button "chooseAction"
Best
Klaus
Re: Option buttons can have behavior?
Posted: Mon Apr 07, 2014 11:51 am
by Mag
Thank you Klaus!
Done the test. It seems as if LC does not want to communicate about it, or maybe the empty result is a message too (as told by the first axiom on communication by Paul Watzlawick "One Cannot Not Communicate")
Anyway, if I write wrong the name of the button I get the (correct) error:
Message execution error:
Error description: Chunk: no such object
Hint: chooseActionxy
Re: Option buttons can have behavior?
Posted: Mon Apr 07, 2014 11:54 am
by Klaus
Re: Option buttons can have behavior?
Posted: Mon Apr 07, 2014 11:58 am
by Mag
Yes, also with answer command.
Code: Select all
on mouseUp
try
answer the behavior of button "chooseAction"
catch e
answer "Error:" && e
end try
end mouseUp
PS
And no errors raised.
Re: Option buttons can have behavior?
Posted: Mon Apr 07, 2014 12:39 pm
by bn
Hi Mag,
have a look at this stack.
It sets the behavior of 2 option menu buttons.
Kind regards
Bernd
Re: Option buttons can have behavior?
Posted: Mon Apr 07, 2014 2:35 pm
by Mag
Thank you Bernd, when I saw that in your stack the set behavior command works fine, I tought that the problem could be the reference in another card, so I tried to replaced "card 1" with the short name of the card and this worked!
So, this works:
Code: Select all
set the behavior of button "chooseAction" to the long id of button "ActionPopup" of card "Codes" of stack "TM-CodeLibrary" -- works
...and this don't wrk:
Code: Select all
set the behavior of button "chooseAction" to the long id of button "ActionPopup" of card 1 of stack "TM-CodeLibrary" -- don't work
Re: Option buttons can have behavior?
Posted: Mon Apr 07, 2014 3:19 pm
by Klaus
Ah, good to know, thank you!
Re: Option buttons can have behavior?
Posted: Mon Apr 07, 2014 4:46 pm
by Mag
Thanks to your contribute to get the solution.