Extracting a reference to a stack
Mike Bonner
bonnmike at gmail.com
Sun Aug 9 10:26:20 EDT 2015
Hmm. It works fine for me.. Since you're "getting" the property for the
object itself, the reference is based on that object. IE
get the owningstack of <mylongid> -- the long id being used sets the scope
starting at the object in question, so that when it references "the name of
this stack" its relative to that object. I've only tried it in 7.0.6,
perhaps things behave different in other versions?
If I use the long id of an object as the target of the getprop, it works no
matter which stack is topmost. I suspect it could be used to get the
actual stack name of a stackfile too (since the saved name and the name of
the stack don't necessarily have to correlate)
Yep, it works.
get the owningstack of (the long id of cd 1 of stack
"C:/Users/Mike/Desktop/lc/whateverstack.livecode")
Though I guess you could just use-- cd 1 of stack
"C:/Users/Mike/Desktop/lc/whatever.livecode" without having to get the long
id.
Of course doing this is pretty silly since you can just "put the name of
stack "path/to/stackfile.livecode"
On Sun, Aug 9, 2015 at 7:42 AM, Peter M. Brigham <pmbrig at gmail.com> wrote:
> Clever. But since the long id of the object is not used by the getprop
> handler, this always returns the name of the topstack, so it can't be used
> for more general situations, eg, if you want to get the owningstack of a
> control on a stack that is suspended.
>
> -- Peter
>
> Peter M. Brigham
> pmbrig at gmail.com
> http://home.comcast.net/~pmbrig
>
>
> On Aug 9, 2015, at 2:43 AM, Mike Bonner wrote:
>
> > Ok. Better way. Use a virtual getprop in a library stack
> >
> > getprop owningstack
> > return (the name of this stack)
> > end owningstack
> >
> > Then if you have the long id of an object you can do this..
> > get the owningstack of myLongId
> > and "it" will contain the stackname. (should also work inserted into
> > front, right?)
> >
> > On Sat, Aug 8, 2015 at 11:47 PM, Mike Bonner <bonnmike at gmail.com> wrote:
> >
> >> This may not do things in the required way, but.. If you have a library
> >> stack with a function or command that just grabs the name of "this
> stack"
> >> then you can dispatch or send the request to the object and POOF it'll
> tell
> >> you what stack its on, no parsing necessary.
> >>
> >> Just tried it here, and it works fine.
> >>
> >> On Sat, Aug 8, 2015 at 7:03 PM, Richard Gaskin <
> ambassador at fourthworld.com
> >>> wrote:
> >>
> >>> David Bovill wrote:
> >>>
> >>>> Yes - you're right. The long name is the only case and like you I
> >>>> only use long ids in the use cases I have. Except when I store
> >>>> references when I use the ruggedID handler of the IDE - that should
> >>>> be a native reference I think?
> >>>
> >>> It would be nice to have an engine version of revRuggedID, or for that
> >>> function definition to just be moved from revbackscriptlibrary to
> >>> revcommonlibrary, since the latter is copied into every standalone so
> >>> everyone would have it everywhere.
> >>>
> >>> In fact, since both of those libraries are now text-only stacks, anyone
> >>> sufficiently motivated could make the move and submit a pull request in
> >>> github.
> >>>
> >>>
> >>> --
> >>> Richard Gaskin
> >>> Fourth World Systems
> >>> Software Design and Development for the Desktop, Mobile, and the Web
> >>> ____________________________________________________________________
> >>> Ambassador at FourthWorld.com http://www.FourthWorld.com
> >>>
> >>> _______________________________________________
> >>> 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
> >>>
> >>
> >>
> > _______________________________________________
> > 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
>
>
> _______________________________________________
> 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