name resolution stinker

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

name resolution stinker

Mike Kerner via use-livecode
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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: name resolution stinker

Mike Kerner via use-livecode
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 <[hidden email]> 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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: name resolution stinker

Mike Kerner via use-livecode
In reply to this post by Mike Kerner via use-livecode
On 04/11/2018 09:08 AM, Bob Sneidar via use-livecode wrote:
> put quote & tDataGrid & quote && "of" && tCurrentCard into tGridLongName

because you're using the short name of the group.

put "group" && quote & tDataGrid & quote && "of" && tCurrentCard into
tGridLongName

or

put the name of group dgsites into tDataGrid and then
put quote & tDataGrid & quote && "of" && tCurrentCard into tGridLongName

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: name resolution stinker

Mike Kerner via use-livecode
In reply to this post by Mike Kerner via use-livecode
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 <
[hidden email]> 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 <
> [hidden email]> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: name resolution stinker

Mike Kerner via use-livecode
In reply to this post by Mike Kerner via use-livecode
But the variable 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"

I cannot reference group tGridLongName, but I can reference group tGridShortName of <whatever long owner reference>
Apparently there is a/an <object> only works with short names of objects. Something in the dictionary may be a hint. It says "there is a" is implemented as an internal function so has a lower precedence as other operators.

Bob S

> On Apr 11, 2018, at 09:43 , Mark Wieder via use-livecode <[hidden email]> wrote:
>
> because you're using the short name of the group.


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: name resolution stinker

Mike Kerner via use-livecode
In reply to this post by Mike Kerner via use-livecode
It probably would help but I am referencing the object in other places, for instance I am getting the tablename of group tGridLongName and that fails as well.

As I posted the workaround is to reference it by group <shortname> of <long owner reference>

Bob S


> On Apr 11, 2018, at 09:51 , Mike Bonner via use-livecode <[hidden email]> wrote:
>
> 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.


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: name resolution stinker

Mike Kerner via use-livecode
In reply to this post by Mike Kerner via use-livecode
On 04/11/2018 09:55 AM, Bob Sneidar via use-livecode wrote:
> But the variable 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"

Exactly.
It *should* resolve to group "dgsites" of...

Ensure that the object type is part of tGridLongName somehow.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: name resolution stinker

Mike Kerner via use-livecode
Not to be argumentative, but I cannot express if there is a tGridLongName. That will not compile.

Bob S


> On Apr 11, 2018, at 10:49 , Mark Wieder via use-livecode <[hidden email]> wrote:
>
> On 04/11/2018 09:55 AM, Bob Sneidar via use-livecode wrote:
>> But the variable 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"
>
> Exactly.
> It *should* resolve to group "dgsites" of...
>
> Ensure that the object type is part of tGridLongName somehow.
>
> --
> Mark Wieder
> [hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: name resolution stinker

Mike Kerner via use-livecode
Typed the following in the message box:

put the long id of me into x; put there is an x & cr & x

Selected a grouped object on a substack and pressed return. Got true and
the long ID.
On Wed, Apr 11, 2018 at 2:01 PM Bob Sneidar via use-livecode <
[hidden email]> wrote:

> Not to be argumentative, but I cannot express if there is a tGridLongName.
> That will not compile.
>
> Bob S
>
>
> > On Apr 11, 2018, at 10:49 , Mark Wieder via use-livecode <
> [hidden email]> wrote:
> >
> > On 04/11/2018 09:55 AM, Bob Sneidar via use-livecode wrote:
> >> But the variable 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"
> >
> > Exactly.
> > It *should* resolve to group "dgsites" of...
> >
> > Ensure that the object type is part of tGridLongName somehow.
> >
> > --
> > Mark Wieder
> > [hidden email]
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: name resolution stinker

Mike Kerner via use-livecode
Have not tried any of the offerings. But, at least in HC, it was important to
isolate all card references with parentheses. Otherwise the engine would
concatenate any text following the ostensible card reference and create a
mess:

blah, blah, blah of (cd id 1002) of stack....

Not sure if LC is more adept, and this is not required any longer. I always
do so, unless the card reference is at the very end of the line:

... of cd ID 1001

Craig Newman



--
Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: name resolution stinker

Mike Kerner via use-livecode
In reply to this post by Mike Kerner via use-livecode
I think the problem here is that you are mixing up to methods of referencing controls...

You can either do:

  there is a group tGroupName of ...

As syntax *or* :

  there is a tLongIdOfGroup

The 'group' chunk expects a string which is a name of a group - it isn't the same as putting 'group' in front of the string.

Try making tGridLongName with the word 'group' at the front (I think someone else suggested this) then that should work.

Warmest Regards,

Mark.

Sent from my iPhone

> On 11 Apr 2018, at 17:08, Bob Sneidar via use-livecode <[hidden email]> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: name resolution stinker

Mike Kerner via use-livecode
put the id of tCurrentCard into tCardID
put (there is a group id (the id of group tDataGrid of card id tCardID)
into tGroupExists
if not tGroupExists then next repeat

Sean Cole
*Pi Digital Productions Ltd*

On 12 April 2018 at 13:14, Mark Waddingham via use-livecode <
[hidden email]> wrote:

> I think the problem here is that you are mixing up to methods of
> referencing controls...
>
> You can either do:
>
>   there is a group tGroupName of ...
>
> As syntax *or* :
>
>   there is a tLongIdOfGroup
>
> The 'group' chunk expects a string which is a name of a group - it isn't
> the same as putting 'group' in front of the string.
>
> Try making tGridLongName with the word 'group' at the front (I think
> someone else suggested this) then that should work.
>
> Warmest Regards,
>
> Mark.
>
> Sent from my iPhone
>
> > On 11 Apr 2018, at 17:08, Bob Sneidar via use-livecode <
> [hidden email]> 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
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: name resolution stinker

Mike Kerner via use-livecode
In reply to this post by Mike Kerner via use-livecode
Thanks Mark. I came to the same conclusion. For my purposes the first method is the best. I start with the short name of a datagrid, then tried to build the long name knowing the long id of the owning card. Instead it's easier to say:

there is a group <shortname> of <long id of card>

Bob S


> On Apr 12, 2018, at 05:14 , Mark Waddingham via use-livecode <[hidden email]> wrote:
>
> I think the problem here is that you are mixing up to methods of referencing controls...
>
> You can either do:
>
>  there is a group tGroupName of ...
>
> As syntax *or* :
>
>  there is a tLongIdOfGroup
>
> The 'group' chunk expects a string which is a name of a group - it isn't the same as putting 'group' in front of the string.
>
> Try making tGridLongName with the word 'group' at the front (I think someone else suggested this) then that should work.
>
> Warmest Regards,
>
> Mark.
>
> Sent from my iPhone


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode