Stylistic question.
Pi Digital
sean at pidigital.co.uk
Tue Sep 6 04:52:25 EDT 2022
Arriving late to the conversation. I never put code into buttons other that enough to cover messages. These will only have enough code in them to pass on the rest of the message. Eg
on mouseUp pBtn
btn_nameOfButtonMUp pBtn
end mouseUp
on mouseRelease
btn_nameOfBtnMRel
end mouseRelease
Then I’d have the main code in either the card or stack script. Cards and stacks are a lot harder to delete than an object. Too many times I’ve seen objects get deleted accidentally and loose a heap of code.
For what it’s worth, my preference is for If/Then/Else rather than Switch/Case/Default. But sometimes it is better, not to mention faster. But even so, for something like an option button I would use
on menuPick pOption
btn_btnNameMenuP pOption
end menuPick
Rather than put the switch code into the button. Rebuilding those few lines of code in a lost/deleted button is far easier than trying to remember all of the other operations it could have had in it.
I hope you are all well, btw :)
Sean Cole
Pi Digital
More information about the use-livecode
mailing list