On 18-Oct-02, Robert M. Muench wrote:

> Hi, I need some VID guru help for the following problem/questions:

> 1. As I understand VID
>     field-layout: [
>         lab "surname" surname: fld return
>         lab "lastname" lastname: fld return
>         ...
>     ]

> Executing <layout field-layout> anywhere in my script will create
> two global words 'surname and 'lastname referencing field objects.
> Is this right?

Yes, assuming fld is a field style you've created.  ie...

lo: [
    style fld field 40 ; create short field
    across
    label "surname" surname: fld return
    label "lastname" lastname: fld return
]
view layout lo

> 2. My problem is that I dynamically create a block like field-layout
> in a function and execute the layout command in this function too.
> I'm using code like
>     repend field-layout [to-set-path field 'fld 'return]
> To get the variables into the block. I'm using to-set-path and not
> to-set-word because field can be a path too.

> That's the result I get:
>     ** Script Error: surname has no value
>     ** Where: do-facets
>     ** Near:
>     surname:

> Hmm... Of course has 'surname no value. I expect the layout function
> to assign a value to it and add it to the global context.

> If I change to-set-path to-set-word everything works fine. Is there
> anything I'm missing? Robert

Hmmm.  Assuming I've understood what you're trying to do, I'd feel
that using compose on the block would be simplier than the above. 
ie, something like this...

s-name: "Bloggs"
lo: [
    across
]
append lo compose [label "surname" surname: field (s-name) return]
view layout lo

And in fact s-name: could be surname: if you wanted, which would allow
you to move it out of the layout.  ie...

surname: "Bloggs"
lo: [
    across
]
append lo compose [
    label "surname" field (surname) [print surname]
    return
]
view layout lo

All of which assumes my guess at what you're trying to do is right...

-- 
Carl Read

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to