On 17/7/99 7:53 pm Scott Raney <[EMAIL PROTECTED]> wrote:

>We just got a request for something like the following:
>put "field 1 of card 3" into X
>put Z/4 into value(X)
>
>This isn't supported in any xTalk as far as I can tell, but does seem
>like a good idea.  I've never been very comfortable with xTalk's
>implied indirect reference behavior:
>put "field 1 of card 3" into X
>select X
>
>(In MetaCard, this is commonly followed by something like "put Z/4
>into the selectedObject", which achieves the original goal, but in
>kind of a roundabout way).
>
>There are a lot of cases where this automatic dereferencing works, but
>it *is* ambiguous, and there are lots of hand-coded routines in the
>engine to distinguish the cases where its OK to dereference a variable
>to get an object if that's what's needed (such as when setting a
>property).  And certainly an explicit way to do this kind of thing
>would be faster than just having the engine try it automatically (and
>a *lot* faster than using "do" or "value()" which have vastly more
>overhead).
>
>One way to do this would be to have a function that does this, similar
>to the way the selectedField() or the foundField() work.  How about:
>put "button 1" into X
>put "whatever" into objectReference(X)
>
>It might also be possible to do it by adding a new chunk type "object"
>that implies a dereference:
>put "button 1" into X
>put "whatever" into object X
>
>But the latter could get hairy to implement:
>put "whatever" into object X of stack "somestack"
>
>Other ideas?

Perhaps you could implement a defaultCard property:

put "my object" into tName
set the defaultCard to cd 2 of stack "abc"
put "whatever" into control tName

The only restriction is that you either must use "control" or must 
differentiate the type of object by saying "button tName", "field tName" 
etc.

Or perhaps extend the "me" concept by creating "you":

set the defaultObject to button 1
put "whatever" into you
set the defaultObject to "cd 3 of stack "xyz" --note you can use a 
variable/string or normal object ref here
put word 3 of me into you

Regards,

Kevin

>  Scott
>
>********************************************************
>Scott Raney  [EMAIL PROTECTED]  http://www.metacard.com
>MetaCard: You know, there's an easier way to do that...

Kevin Miller <[EMAIL PROTECTED]> <http://www.xworlds.com/>
Cross Worlds Computing, MetaCard Distributors, Custom Development.
Tel: +44 (0)131 672 2909.  Fax: +44 (0)1639 830 707.

Reply via email to