VID: layout problem
[1/5] from: robert:muench:robertmuench at: 17-Oct-2002 17:38
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?
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
[2/5] from: greggirwin:mindspring at: 17-Oct-2002 11:21
Hi Robert,
<< I'm using to-set-path and not to-set-word because field can be a path
too.
...If I change to-set-path to-set-word everything works fine. >>
If you use a string value (e.g. "a/b/c") TO SET-WORD! should work on it, but
it does fail on true path values. Will that work for you with the way you're
generating the code? If you have a path! value already, you could do this:
path-to-set-word: func [path] [
to set-word! rejoin [first path "/" next path]
]
path-to-set-word 'x/y/z
path-to-set-word 'abc/def/ghi
--Gregg
[3/5] from: g:santilli:tiscalinet:it at: 17-Oct-2002 20:02
Hi Robert,
On Thursday, October 17, 2002, 5:38:23 PM, you wrote:
RMM> To get the variables into the block. I'm using to-set-path and not
RMM> to-set-word because field can be a path too.
But if it's only a word I don't think it would work. Also, I think
LAYOUT does not support set-paths for setting a face.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[4/5] from: carl::cybercraft::co::nz at: 18-Oct-2002 10:36
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
<<quoted lines omitted: 6>>
> 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.
<<quoted lines omitted: 11>>
> 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
[5/5] from: robert:muench:robertmuench at: 21-Oct-2002 7:56
> -----Original Message-----
> From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]
<<quoted lines omitted: 3>>
> Subject: [REBOL] Re: VID: layout problem
> But if it's only a word I don't think it would work.
Hi, I though that too but to-set-path works if you just provide a word!
:-). So I don't know why we need to-set-word. I have to say that I
didn't checked if to-set-path with a word yields a path! Or a word!.
> Also, I think LAYOUT does not support set-paths for setting a face.
Ok, I think that might be the problem. Robert
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted