[REBOL] Problem updating a pane before being displayed
From: jvargas:whywire at: 5-May-2003 13:58
Hello all. I am trying to create some dynamic forms. I am initializing
and hiding some faces before they get displayed. However I get odd
results, sometimes things get displayed correctly others not. Here is a
sample code of what I am doing. Am I missing something? Is there a
better way to change the look and feel of a layout before it gets
displayed?
Thanks, Jaime
REBOL[]
update-one: does [
either equal? vmenu/text "opt1" [
vlbl1/text: "lbl1"
vfld1/text: "text for fld1"
hide [vlbl2 vfld2]
show [vlbl1 vfld1]
][
vlbl2/text: "lbl2"
vfld2/text: "text for fld2"
hide [vlbl1 vfld1]
show [vlbl2 vfld2]
]
]
main: layout [
button "Pane One with fld1" 150 [
vpane/text: "one"
panels/pane: get to-word vpane/text
vmenu/text: "opt1"
update-one
view/new l1
]
button "Pane One with fld2" 150 [
vpane/text: "two"
panels/pane: get to-word vpane/text
vmenu/text: "opt2"
update-one
view/new l1
]
]
l1: layout [
across
vpane: choice "one" "two"
[ panels/pane: get to-word value show panels ]
return
panels: box 300x300
]
one: layout [
backcolor white
across
h2 "This is Pane One"
return
label "Menu" 80
vmenu: choice "opt1" "opt2"
[ update-one ]
return
vlbl1: label 80
vfld1: field 150
return
vlbl2: label 80
vfld2: field 150
return
]
two: layout [
backcolor white
across
h2 "This is Pane Two" return
text "It is empty for the moment"
]
center-face main
view main