name resolution stinker

Mike Bonner bonnmike at gmail.com
Wed Apr 11 12:51:13 EDT 2018


Not sure if this will be userful, but would placing the following script in
your stack (or frontscript I guess) work easier?

command amIHere pName
try
   dispatch "imHere" to group pName of the current card
catch tError
   return false
end try
end amIHere

command imHere
   return true
end imHere

Might be cheating using try this way, but I think it should work pretty
well.

If the dispatch fails due to object (or in this case, background) not found
error, you get false, if the dispatch is handled you get true.

On Wed, Apr 11, 2018 at 10:23 AM, Bob Sneidar via use-livecode <
use-livecode at lists.runrev.com> wrote:

> I used DO to evaluate the statement and of course that works, but any
> reference to group <variable containing group long name or long id> fails
> to resolve.
>
> I worked around this anomaly (which I vaguely recall I've run into before)
> by using
> there is a group tDataGrid of tCurrentCard
>
> tDatagrid is the short name of the datagrid
> tCurrentCard is the long id of the card the datagrid is on
>
> Apparently you cannot reference an object using it's full id, but you can
> reference an object using it's short name and the long id of the parent! I
> find this odd, but oh well.
>
> Bob S
>
>
> > On Apr 11, 2018, at 09:08 , Bob Sneidar via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> >
> > Ok here is a real stinker.
> >
> > put quote & tDataGrid & quote && "of" && tCurrentCard into tGridLongName
> > put (there is a group tGridLongName) into tGroupExists
> > if not tGroupExists then next repeat
> >
> > tGridLongName resolves to:
> > "dgsites" of card id 1002 of stack "Sites" of stack
> "/Users/bobsneidar/Documents/Livecode Projects/Forms Generator 8/Forms
> Generator 8.livecode"
> >
> > When in the message box I type:
> > put there is a group "dgsites" of card id 1002 of stack "Sites" of stack
> "/Users/bobsneidar/Documents/Livecode Projects/Forms Generator 8/Forms
> Generator 8.livecode"
> >
> > I get true.
> >
> > But the code:
> > put (there is a group tGridLongName) into tGroupExists
> >
> > returns false. tGridLongName is not resolving in this statement.
> >
> > Is this another use case for DO?
> >
> > Bob S
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list