mouseDown message sent but not triggering the handler in a behavior

Andre.Bisseret Andre.Bisseret at inria.fr
Thu Jul 15 04:54:18 CDT 2010


Le 15 juil. 10 à 11:05, Richmond a écrit :

> On 07/15/2010 11:57 AM, Andre.Bisseret wrote:
>> Bonjour,
>>
>> On a stack, in a group, I have a button which is supposed to show a  
>> field on mouseDown and hide this same field on mouseUp.
>>
>> The two handlers (mouseDown and mouseUp) are in the script of a  
>> behavior button to which the group is set.
>
> Isn't that rather a complicated way of doing things?
>
> I just made a stack and imported an img "iXYZ"'
>
> and put this directly in a btn script:
>
> on mouseDown
>   set the vis of img "iXYZ" to true
> end mouseDown
>
> on mouseUp
>   set the vis of img "iXYZ" to false
> end mouseUp
>
> and, needless to say, it works perfectly. In fact, many Thanks, it  
> gives me an idea
> for a "discovery stack" for the kids in my EFL school.

I am using this quite often, for example to give give a bit of  help  
information (specially if I find it too long fo put it in tooltips)
>
> Why the need to put this in the script of a behavior button????

Bonjour Richmond,

Thanks for your reply.
You are right: normally this works very well when the handlers are in  
the script of the object (button or image, …)

In fact, my app. is a bit more complex ;-) I explained only the small  
part where I got the problem.

I have a main stack from which the user (physician) can create  
(cloning a model stack) a lot of independant stacks (not substacks).  
They are medical files, one for each patient.
Up to now, the necessary scripts were repeated in each of this files  
(and when a modification was necessary I had to do it (by program) on  
each of the numerous files).
I moved them in behavior buttons (on card 2 of the main stack) so that  
now I have practically no handlers repeated in the independant files.

Far more practical in my opinion. As soon as I modifie any handler in  
the behavior buttons, they are immediately active on every independant  
stack.

André

>>
>> When opening the stack, on a first mouseDown on the button, nothing  
>> happens (the field is not shown).
>>
>> However, the message watcher shows that, after a mouseEnter  
>> message, a mouseDown message is actually sent!
>>
>> Now, the field is shown as expected only on a second mouseDown! and  
>> then all keeps been as expected: any subsequent mouseDown triggers  
>> the visible of the field! (if I close the stack and reopen it, the  
>> same phenomena is repeated).
>>
>> I have another button on the same card, with a similar handler  
>> (showing a field on mouseDown and hide it on mouseUp) which works  
>> normally. The difference is that for this one, the handler is  
>> directly in the script of the button.
>>
>> Am I missing something about messages/handlers in behavior buttons?
>>
>> Any help would be much appreciated
>>
>> Best regards from Grenoble
>>
>> André
>>






More information about the use-livecode mailing list