Help please: can't get behavior script to work

Peter Brigham MD pmbrig at gmail.com
Sat Oct 23 14:00:59 EDT 2010


On Oct 23, 2010, at 11:41 AM, André Bisseret wrote:

>
> Le 23 oct. 10 à 16:29, Ian McKnight a écrit :
>
>>
>> Hi Andre
>>
>> It does help when you read the manual :) I did read it but I missed  
>> the
>> significance of the last line!
>>
>> Anyway problem is solved all I need do is pass the mouseWithin  
>> message in
>> each button - not a great price to pay.
>
> Ian,
>
> Just curious, why do you prefer mouseWithin to mouseEnter or  
> mouseMove?
> (with one of these, you should not have to "pay any price" ;-)),  
> should you?

I always use mousemove for this kind of thing, for that exact reason  
-- no mousemove is sent unless the object itself has a mousemove  
handler, which is cumbersome if you want some generic behavior when  
the mouse is within any button, for instance.

> André
>
>> And thank you for your very quick reply.
>>
>>
>> On 23 October 2010 15:01, André Bisseret  
>> <andre.bisseret at wanadoo.fr> wrote:
>>
>>> Bonjour Ian,
>>>
>>> I just tried the following
>>> - created:
>>> - a stack
>>> - a group "grButton" of 3 buttons: Button1, Button2, Button3
>>> - another group "grBtn" of 3 buttons: Btn1, Btn2, Btn3
>>> - grouped the two groups in a super group "grGlobal"
>>>
>>> - a button "BtnBehavior"
>>> - a field "fldTarget"
>>>
>>> - put the following handler in the script of "BtnBehavior":
>>> on mouseWithin
>>> put the short name of the target into fld "fldTarget"
>>> end mouseWithin
>>>
>>> Finally i set the behavior of grp "grGlobal" to the long id of btn
>>> "btnBehavior" of this card.
>>>
>>> Hoping that replicate your problem,
>>> Well:
>>> Does not work with mouseWithin
>>>
>>> But that works with other messages: with mouseUp, with mouseDown,  
>>> with
>>> mouseMove, with mouseEnter
>>>
>>> Seems that the explanation is the last line of the doc on  
>>> "mouseWithin" in
>>> the Dictionary:
>>>
>>> Note:  If there is no mouseWithinhandler in the target  
>>> object'sscript, no
>>> mouseWithinmessage is sent, even if there is a mouseWithinhandler  
>>> in an
>>> object that's further along the message path.
>>>
>>> HTH
>>>
>>> Best regards from Grenoble
>>>
>>> André
>>>
>>> Le 23 oct. 10 à 13:19, Ian McKnight a écrit :
>>>
>>>
>>>> Hi
>>>>
>>>> I have a number of buttons which are grouped together, and then  
>>>> this group
>>>> is grouped with other similar groups to form a super-group. I  
>>>> have in
>>>> excess
>>>> of 300 buttons then that each represent a date. When I put the  
>>>> mouse over
>>>> any one of the buttons I want to access an array and display the  
>>>> relevant
>>>> information for that day in a separate field. I have a  
>>>> mouseWithin handler
>>>> to access the data.
>>>>
>>>> When the mouseWithin handler is in the script of the actual  
>>>> button all
>>>> works
>>>> as it should.
>>>>
>>>> When I move the script to a separate button and set the behavior  
>>>> of my
>>>> original button to it - nothing happens. The Inspector shows the  
>>>> behavior
>>>> location correctly.
>>>>
>>>> There are no other mouseWithin handlers in the message path.
>>>>
>>>> This is the line I used in the message box to set the behavior of  
>>>> the
>>>> first
>>>> of my buttons.
>>>>
>>>> set the behavior of btn "checkBx 0" of grp "sepGrp" of cd  
>>>> "calendar" to
>>>> the
>>>> long id of btn "behave" of cd "calendar"
>>>>
>>>> I even tried referencing all the groups but still nothing happened.
>>>>
>>>> set the behavior of btn "checkBx 0" of grp "sepGrp" of grp  
>>>> "calendargrp"
>>>> of
>>>> cd "calendar" to the long id of btn "behave" of cd "calendar"
>>>>
>>>> This is the corresponding behavior entry from the Inspector
>>>>
>>>> button id 1647 of stack "timeTable3"
>>>>
>>>> which resolves to the button with my mousewithin script.
>>>>
>>>> I can strip out the core of the script into a separate handler  
>>>> and place
>>>> it
>>>> in the card script but I'd rather not replicate the remaining  
>>>> code 300+
>>>> times (even though it is only a dozen lines) if I can get  
>>>> behaviors to
>>>> work.
>>>>
>>>>
>>>> I'm using LiveCode 4.5 Bld 1080
>>>>
>>>> Can anyone suggest what I'm doing wrong?
>>>>
>>>>
>>>> Thanks.
>>>>
>>>>
>>>> --
>>>> Regards
>>>>
>>>>
>>>> Ian McKnight
>>>>
>>>> iangmcknight at gmail.com
>>>> =======================


-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig





More information about the Use-livecode mailing list