Re: getProp puzzle

2016-09-12 Thread dfepstein


Thanks to Mike Bonner for his helpful suggestions. Stack A and Stack B are both 
mainStacks. Further tests seem to confirm this rule: 

  

A setProp or getProp handler in the script of stack A cannot be invoked for a 
target in Stack B UNLESS we have "started using" stack A (even if Stack A is 
the frontmost stack). 

  

On first thought this seems a little strange to me. For function or command 
handlers, we only need to "start using" a stack if we want to call its script's 
handlers when that stack is not frontmost; and when we "start using" it those 
handlers are just as accessible as the handlers in the frontmost stack's 
script. But for getProp and setProp handlers, the script of the frontmost stack 
and the script of a stack we have started using do not have the same efficacy. 

  

Perhaps the logic is clearer if Stack B has its own getProp myProp handler 
whose script differs from Stack A's getProp myProp handler.  In that case it 
probably makes sense for the virtual property of an object in Stack B to follow 
the getProp rules of its own stack, when called from Stack A (even though a 
function handler in Stack A that queries properties of Stack B, invoked while 
Stack A is frontmost, would take priority over a function handler in Stack B). 

  

David Epstein 
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: getProp puzzle

2016-09-11 Thread Mike Bonner
Hmm. Ok. My mistake.  Seems to work.. is stack B a substack of stack A?  If
not, that might be the issue.. If stack b is a mainstack, then the request
can't go up the message path to stack a, which then makes my previous point
applicable.

On Sun, Sep 11, 2016 at 3:59 PM, Mike Bonner  wrote:

> The "of stack b" part, delineates where the pseudo property resides. Since
> there is no getprop nSL of stack b, you get nothing back.  Better off to
> create a function that takes an object reference as a parameter, and make
> sure its in the message path so you can hit it from anywhere.
>
> On Sun, Sep 11, 2016 at 3:46 PM, David Epstein 
> wrote:
>
>> The script of stack “A” has a getProp handler to report the number of
>> lines in an object’s script:
>>
>> getProp nSL
>>   return the number of lines in the script of the target
>> end nSL
>>
>> With stack A frontmost, I type in the message box “the nSL of this stack”
>> or “the nSL of stack’A’”, and I get the expected result.  But with stack A
>> still frontmost, if I type in the message box “the nSL of stack ‘B’” I get
>> an empty result (not even a “0”).
>>
>> What am I missing?
>>
>> Thanks very much.
>>
>> David Epstein
>>
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: getProp puzzle

2016-09-11 Thread Mike Bonner
The "of stack b" part, delineates where the pseudo property resides. Since
there is no getprop nSL of stack b, you get nothing back.  Better off to
create a function that takes an object reference as a parameter, and make
sure its in the message path so you can hit it from anywhere.

On Sun, Sep 11, 2016 at 3:46 PM, David Epstein 
wrote:

> The script of stack “A” has a getProp handler to report the number of
> lines in an object’s script:
>
> getProp nSL
>   return the number of lines in the script of the target
> end nSL
>
> With stack A frontmost, I type in the message box “the nSL of this stack”
> or “the nSL of stack’A’”, and I get the expected result.  But with stack A
> still frontmost, if I type in the message box “the nSL of stack ‘B’” I get
> an empty result (not even a “0”).
>
> What am I missing?
>
> Thanks very much.
>
> David Epstein
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

getProp puzzle

2016-09-11 Thread David Epstein
The script of stack “A” has a getProp handler to report the number of lines in 
an object’s script:

getProp nSL
  return the number of lines in the script of the target
end nSL

With stack A frontmost, I type in the message box “the nSL of this stack” or 
“the nSL of stack’A’”, and I get the expected result.  But with stack A still 
frontmost, if I type in the message box “the nSL of stack ‘B’” I get an empty 
result (not even a “0”).  

What am I missing?

Thanks very much.

David Epstein

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode