Dynamic Views possible
[1/3] from: yvan_iigs::gmx::net at: 2-Dec-2006 14:11
Hello,
is there a way to tell a view which fields it should show by passing any
kind of parameters?
Lets assume I have a video database with the following strings per video:
title, producer, release-date, length
Now if I want to look at a video record I can do it the following way:
view layout
[
text title
text producer
text release-date
text length
]
But if I just want to see the title I would have to do the following:
view layout [ text title]
and if I just want to see the title and the producer
view layout
[
text title
text producer
]
okay, it's getting boring. I have much more than just 4 different variable
per video record and I'm looking to program a function which let's me chose
which fields of the video-record should be shown without having to program
a special view for each possible combination.
Is there a way to to this?
Cheers Yvan
[2/3] from: rebol::ccsducto::com::ar at: 2-Dec-2006 12:23
Hi Yvan,
Try something like this, of course you can do the function as complex as you
want but, this is the idea
func-lay: func [fld-block /local lay-block][
lay-block: copy [across]
foreach [f-name f-data] fld-block [
append lay-block reduce ['txt rejoin [to-string f-name ": "] 'txt
to-string f-data 'return]
]
lay-block
]
view layout func-lay [name1 text1 name2 text2]
César
[3/3] from: yvan_iigs::gmx::net at: 3-Dec-2006 14:50
Hello Cesar,
I think I see what you mean. The concept of dynamic views doestn't exist and
I more or lesse have to make the layout myself before entering it into the
view. Okay, I think I have to modify your func-lay a little bit before it
takes me to my goal.
Thank you for the hint.
Cheers
Yvan
On 2.12.2006, you wrote:
> Hi Yvan,
> Try something like this, of course you can do the function as complex as
<<quoted lines omitted: 65>>
>>
>>
Regards
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted