Virtual custom property question

Ken Ray kray at sonsothunder.com
Sat Nov 5 17:28:24 EST 2005


On 11/5/05 9:36 AM, "David Bovill" <david at openpartnership.net> wrote:

> If I set the custom property of a control from somewhere else - lets
> say:
> 
>      set the display_Colour of group 1 to "red"
> 
> And this group has defined an appropriate setprop handler - say:
> 
>      setprop display_Colour someColour
>          set the bgColor of btn 1 of me to someColour
>      end display_Colour
> 
> Is there a way to find out which control is trying to set the custom
> property?

Yes, you look at the 'executionContexts'... the last line will be the group
itself (i.e. the last object to act on the script), but the *second to last*
line will be the object that was trying to set the custom property.

Each line of the executionContexts is in this format:

   <long ID of the object>,<handler>,<script line>

So if I have a button (button ID 1002) on a card, with a script:

  on mouseUp
    set the test of this card to 100
  end mouseUp

and my card script reads:

  setProp test pVal
    put the executionContexts
  end test

here's what I get:

  button id 1002 of card id 1002 of stack "Untitled 1",mouseUp,2
  card id 1002 of stack "Untitled 1",test,2

So if you take item 1 of line -2 of the executionContexts, you get the long
id to the object that made the original propery setting.


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com





More information about the use-livecode mailing list