tehe ExecutionContexts

Jan Decroos jan.decroos at groepvanroey.be
Tue Jan 27 03:44:39 EST 2004


"MisterX" <b.xavier at internet.lu> writes:

>Hi everyone,
>
>In my joyous mood to set the best possible quality in the 
>next Script Editor X. My personal full featured editor 
>template (of many to come). Lately we talked about filtering
>the variables (GUI already impletented!) in the Var. Watcher.
>
>In MC the variable watcher has a companion stack called the
>"Execution Context". 
>
>This stack was integrated into the GUI of RR's Variable Watcher.
>
>I've done the integration as well in my VWx for MC but before
>attacking the RR integration, I wanted to elucidate the mistery
>of execution contexts. I've searched both documentations but 
>there is NO entry regarding it... 
>
>Anyone have tips to on what it's suppose to do or how use it?
>TIA... 
>

Here's a small example (I made as _test_ for getting local properties from
calling handlers)



on mouseUp
  set the numberformat to "0.###"
  myHandler1
end mouseUp

on myHandler1
  myHandler2
end myHandler1

on myHandler2
  set the caseSensitive to true
  myHandler3
end myHandler2

on myHandler3
  get getLocalPropertyFromCallingHandler("numberformat")
  if it <> empty then set the numberformat to it
  answer 1*5.111111  -- tells "5.111"
  
  get getLocalPropertyFromCallingHandler("caseSensitive")
  if it <> empty then set the caseSensitive to it
  answer "a" = "A"  -- tells false
end myHandler3

function getLocalPropertyFromCallingHandler pPropertyName
  if pPropertyName is not among the lines of the propertyNames then
StopWithMessage "getLocalPropertyFromCallingHandler: invalid property
name:"&&pPropertyName
  put the executionContexts into lCallingHandlers
  put the number of lines of lCallingHandlers -1 into lNumCallingHandlers
  repeat with i = lNumCallingHandlers down to 1
    put line i of lCallingHandlers into lHandler
    put item 3 of lHandler - 1 into lLnr
    do "put the script of "&(item 1 of lHandler)&" into lScript"
    repeat with j = lLnr down to 1
      put line j of lScript into lLine
      if word 1 of lLine is among the items of "on,function" then exit repeat
      if (word 1 of lLine = "set") and (word 2 of lLine = "the") and (word 3 of
lLine = pPropertyName) then
        repeat with k = 4 to the number of words of lLine
          if word k of lLine = "to" then return the value of word k+1 to -1 of
lLine
        end repeat
      end if
    end repeat
  end repeat
  return empty
end getLocalPropertyFromCallingHandler

on StopWithMessage pMess
  answer error pMess
  exit to top
end StopWithMessage

Regards,
Jan



More information about the use-livecode mailing list