Welcome to Programming LiveCode Q&A, where you can ask questions and receive answers from other members of the community.

Please, ask questions about the book only. If possible, mention section or page number. Don't ask for opinions, ask clear and direct questions only.

Go to main site

Quick Links

Frequently Asked Questions

Errata (1st print)

button's mouseUp default handler

0 votes
p. 99, end of first paragraph about backgrounds. "If the script of a button is empty, the group won't receive a mouseUp message"

Not exactly true: Buttons are created with an empty mouseUp handler:

on mouseUp

end mouseUp

which actually blocks the message. But if you remove this script and click "apply", or create a new script without a mouseUp handler, the mouseUp message will be passed along the message path normally.

But be careful! if you re-open the script of a button with an empty script, the empty mouseUp handler will be recreated ! To be sure that your button remains functionally "scriptless" (what can be useful in some circumstances) you have either to correct the default script with a "pass mouseUp" statement or to create a dummy scipt like

command doAbsolutelyNothing

end doAbsolutelyNothing
asked May 31, 2013 by jhausser (730 points)

1 Answer

0 votes
Please test this again and confirm your results.
answered May 31, 2013 by mark (3,090 points)
Hi Mark,
Yes it works more or less like I wrote (at least with 5.5.4 or 6.0.2 and Mac Lion Mountain).
Minimalist and very rough recipe:
- create a new stack
- put 1 button and 1 field on the card
- group them
- set the script of the group to
      on mouseUp
           put "OK" into fld 1
      end mouseUp
- open the script of the button
- select the default script (empty "on mouseUp") and delete it completely
- immediatly click "Apply"
select the browse tool and click on the button (make the button big enough to be sure to really click inside it).
"OK" appears on the field
- now, open the script of the button again
   the default script will be recreated
click on "Apply"
clear the field, and click on the button again: Nothing. The default script traps the message. But if the button has a script without mouseUp handler, the script is recorded "as it is" and the mouseUp message is passed further away.
OK, contrary to what I said, the default script is not compiled if you don't click on the "apply" button (what I did by reflex) - but then the button is "scriptless" and the message is not stopped.
I don't think one should call it a bug, but actually it should be a little discussion about this default script in the docs.
Jacques
Thanks for testing. Apparently, there is a mistake in the text here. It is being investigated.
...