MouseUp subroutine won't run
Posted: Wed Jul 29, 2009 7:19 pm
I made a group that has two entry fields in it. In the group I put a one line mouseUp subroutine (beep). When I click the group nothing beeps. What did I do wrong?
Questions and answers about the LiveCode platform.
https://forums.livecode.com/
Code: Select all
on mouseUp
beep
end mouseUp
Section 5.5.9 in the user's guide seems to be saying that groups do catch messages. Setting that property just changes if it is before the card or after it I think. The control gets the message before the group no matter what the property is set to. But if there are no subs before the group which catch the message and don't pass it on, the group should get the message, right?Groups don't catch mouseUp messages by themselves. The message has to be caught by a button, field or card before it can be passed on to the group.
A card will pass on the mouseUp message to a group, only if the backgroundBehavior of the group is set to true (see property inspector).
This is slightly wrong. The backgroundBehavior property can turn a group into a "real" background. Groups really are just a collection of objects and catch any message after the object has caught it and before the object passes that message on to a card. However, if there is no object, there is no message to pass on to the card, hence there is no message caught by the group.Section 5.5.9 in the user's guide seems to be saying that groups do catch messages. Setting that property just changes if it is before the card or after it I think.
Code: Select all
on mouseUp
if the mouseLoc is within the rect of grp "Your Group" then
beep
end if
end mouseUp
Comments:
When a field's lockText property is false, the field can be edited: the user can select text, delete text, type, cut, copy, and paste. The cursor becomes an I-beam when the mouse pointer is over the field. When the user clicks in the field, no mouseDown, mouseUp, mouseStillDown, mouseDoubleDown, or mouseDoubleUp messages are sent. (However, if the user Control-clicks or right-clicks, these messages are sent regardless of the field's lockText setting.)
What do you mean a "real" background?This is slightly wrong. The backgroundBehavior property can turn a group into a "real" background.