Goofy button behavior

Ken Norris pixelbird at interisland.net
Sun Mar 9 17:30:03 EST 2003


**********
> Date: Sun, 9 Mar 2003 10:31:59 +0000
> From: Dave Cragg <dcragg at lacscentre.co.uk>
> Subject: Re: Goofy button behavior
> 
> At 2:12 pm -0500 8/3/03, Ken Norris wrote:
>> Howdy,
>> 
>> I have a button which is not part of a group, and never was. It shows its
>> own selection handles, not group selection handles, with "Select Grouped
>> Controls" off, the same as other buttons which are not grouped. If I select
>> buttons which are grouped in that case, it shows the group's selection
>> handles.
>> 
>> All OK so far? OK, now watch this (here's the problem):
>> 
>> It is executing the script of a group. In fact it is mixing the script of a
>> group to which it does not belong (in fact, it is not grouped at all) with
>> its own script.
>> 
>> What's going on and how do I fix it.
> 
> I guess the group's background behavior is set to true. So if an
> event (mouseUp for example) is not handled in the button, it will be
> passed to the group (background).
----------
Why? The button does NOT belong to a group at all.
> Depending on circumstances, you can do one of the following:
> 
> -- turn off "backgroundBehavior" in the group
----------
I need the bg behavior (or else I wouldn't have it to start with).
----------
> --  in the group script, enclose handlers with a condition like this:
> 
> on mouseUp
> if the owner of the target is me then
> ##normal stuff here
> end if
> end mouseUp
> 
> --  catch the events in the non-grouped objects (probably not such a
> practical approach)
----------
Ahh. OK. Pretty wonky solution though. I don't think a non-grouped object
should execute a group handler at all. I think something is wrong here, and
I'd like to find out what it is.

I did replace some buttons which were formerly in the group. How do groups
store and update info about what objects belong to them?

The replaced button in this case was deleted and then recreated from
scratch. When I first created it, it did not execute the group handler.
After I assigned a new hilitedIcon to it, without the show icon on (because
I needed to control how it shows from inside the button script), it suddenly
started executing the handler of a bg group. Once again, please understand,
the button does NOT belong to any group.

Now it shows the icon I assigned according to the script inside it, so it's
OK as long as the script is not empty, but if I delete the script, it WILL
execute the bg group handler (to which it does not belong) again.

There are no mouseUp handlers in the stack or card.

I think a bug in the storage update system of the group is causing the
problem. Somehow, the group is still treating the button as if belongs to
it, even though it doesn't.

If a background group uses button NUMBERS rather than object IDs to track
its member buttons, that might account for it.

Anyone understand how this works?

Best regards,
Ken N.




More information about the use-livecode mailing list