Pane Refresh Problem
[1/3] from: coussement::c::itc::mil::be at: 2-May-2001 11:29
Hi list:
For experimenting with /View, I've written another "Game of Life".
The algorithm works OK with an ASCII output, but I cannot get the result in
/view, because I don't know how to trigger a refresh of the pane.
Here's the code I use for the visual part - max-x and max-y are global words
setting the size of the life map.
<snip>
show-visual: func [
/local x y main society
][
main: layout [
vh2 "Game of Life"
guide
pad 20
button "QUIT" [unview halt]
return
box 2x140 yellow
return
panels: box 300x300
]
society: [
origin 8x8
backdrop black across space 1x1
style alive box red 10x10
style dead box black 10x10
return
]
forever [
make-live ;--- create the life map
;--- dynamically append boxes to pane
for x 1 max-x 1 [
for y 1 max-y 1 [
either (alive? x y)[
append society 'alive
][
append society 'dead
]
]
append society 'return
]
panels/pane: layout society
show panels/pane
view main
]
]
</snip>
It works if I close the generated windowat each generation.
It's for sure not difficult, but I cannot find anything in the Doc :-(
Any idea ?
chr==
[2/3] from: arolls:bigpond:au at: 3-May-2001 1:37
Make a static layout and refer to the
VID gadgets inside by number, in the
pane attribute.
Like this:
view/new lay: layout [
style bx box 10x10 ; little box
across
bx bx return
bx bx
]
; change the third box
set in pick lay/pane 3 'color red
show pick lay/pane 3
You could use image instead of box
for a professional look, although that
might slow it down a bit.
If you really need to alter the layout,
check out Volker Nitsch's insert-face3.r
script of 10-Apr-2001 in Ally mail list.
It takes a while to understand (and I
made an English only version if you're
interested.) but it should benefit you.
Anton.
[3/3] from: coussement:c:itc:mil:be at: 3-May-2001 8:40
Thanks a lot, Anton. I try it right away.
chr==