Mysteries of Me

Bob Sneidar bobsneidar at iotecdigital.com
Thu Nov 1 16:02:12 EDT 2018


Well the big thing it deals with is ambiguity. I have a number of substacks which are similar, like data entry forms for different tables in the database, and these have many controls, properties and scripts in common, but also some that are unique to that particular form. If only one of these "form" stacks were allowed to be open at one time, there would be no ambiguity, but I allow multiple "forms" to be opened at the same time, and when I was using modal stacks, this presented a problem. So if at the beginning of a handler I have:

put getParentCard(the long id of me) into tParentCard -- returns the long id of the parent card
put getParentStack(tParentCard) into tParentStack -- returns the long id of the parent stack

then I can make references like so:

button "btnNew" of tParentCard
the databaseSettings of tParentStack
dispatch updateSettings to tParentStack with "true", "all"

Even if another substack is open modally or happens to be the topstack, or if I have an older version of the same application open in Livecode, there can be no ambiguity because everything is resolving to long ids. I am no longer relying on the fuzzy logic of the parser to figure out exactly which object, card or stack I am referring to. 

Bob S


> On Nov 1, 2018, at 09:39 , Sannyasin Brahmanathaswami via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Bob, that make sense. But why do need those handlers?
> 
> What not just use "of this stack"? 
> 
> Obviously, I am oblivious to the number contexts where you require:
> 
> "...created handlers that return the parent card or stack of an object."
> 
> I am curious what they are?
> 
> BR
> 
> Bob Sneidar via use-livecode wrote:
>> Me is resolving correctly for me in stack, card and behavior scripts attached to them. The issue I think was that you cannot seem to reference card <x> of me in a stack script handler. So I created handlers that return the parent card or stack of an object. The object can be the long id of a card even, when getting the parent stack, and that you can use in any reference so far as I know. 
>> 
>> All it's doing is forcing the full card ID or stack name resolution so the parser doesn't need to use fuzzy logic. 
>> 
>> Bob S





More information about the use-livecode mailing list