view problem - updating windows
[1/6] from: julia:flakmag at: 26-Apr-2001 12:31
Hi, I'm also new to the list - having a great time using REBOL!
I've been having trouble getting an element of a layout to update on its
own, without clicking a button. The only script I can find that does it
is rebcam.r, which I can't get to run without errors. Does anyone know of
an example script or piece of documentation that explains how to do this?
thanks!
Julia Lipman
Eight, Inc.
[2/6] from: carl::rebol::com at: 26-Apr-2001 9:06
Hi Julia,
Saw your email arrive, so thought I would take a crack at answering.
To update an element of a layout, you can use SHOW. In order to
refer to it, you will need either 1) a variable to refer to it, or
2) to know it's position in the layout. The first is most common.
For example:
out: layout [
img-var: image %img1.jpg
text-var: text "test" 200
]
view/new out
img-var/image: load %img2.jpg
show img-var
text-var/text: "New text here!"
show text-var
You could also refer to the faces by position with:
out/pane/1/image: load %img2.jpg
show out/pane/1
In addition, you could refresh the entire layout with:
show out
However, for very large layouts, that can be "expensive".
Note: Buttons have more to them than other types of faces.
For instance, to change the color or text of a button requires
that you change the /colors or /texts fields of the button face.
It all depends on what you are after.
-Carl
[3/6] from: ingo:2b1 at: 26-Apr-2001 22:37
Hi Julia,
I thought you were more after this one, the very basic view clock ...
[REBOL[]
view layout [
d: label form now/time rate 1 feel [
; ------ once every second send an event
engage: func [face a e][
; sorry, I forgot what 'a and 'e are standing for ...
if a = 'time [
face/text: form now/time show face
]
]
]
]
]
kind regards,
Ingo
Once upon a time Julia Lipman spoketh thus:
> Hi, I'm also new to the list - having a great time using REBOL!
> I've been having trouble getting an element of a layout to update on its
<<quoted lines omitted: 8>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
do http://www.2b1.de/
_ . _
ingo@)|_ /| _| _ <We ARE all ONE www._|_o _ _ ._ _
www./_|_) |o(_|(/_ We ARE all FREE> ingo@| |(_|o(_)| (_|
._| ._|
[4/6] from: carl:cybercraft at: 27-Apr-2001 20:37
On 27-Apr-01, Julia Lipman wrote:
> Hi, I'm also new to the list - having a great time using REBOL!
> I've been having trouble getting an element of a layout to update on
> its own, without clicking a button. The only script I can find that
> does it is rebcam.r, which I can't get to run without errors. Does
> anyone know of an example script or piece of documentation that
> explains how to do this?
Hi Julia,
Try this...
rebol []
n1: 0
n2: 0
view layout [
a1: text to-string n1 100
with [
rate: 1 feel: make feel [
engage: [
n1: n1 + 1
a1/text: to-string n1 show a1
]
]
]
a2: text to-string n2 100
with [
rate: 10 feel: make feel [
engage: [
n2: n2 + 1
a2/text: to-string n2 show a2
]
]
]
button "Quit" [unview]
]
Someone else will have to explain why we need 'with, 'rate, 'feel and
'engage just to achieve this as I only know how to make it work.
Which of course may mean I'm doing it wrong, but it does seem to
work... (:
--
Carl Read
[carl--cybercraft--co--nz]
[5/6] from: rgombert:essentiel at: 27-Apr-2001 11:20
you can use a different (simpler) syntax to achive the behavior you want.
se below te a2 definition, wich is a shorter way to set the same feel facet.
rebol []
n1: 0
n2: 0
view layout [
a1: text to-string n1 100
with [
rate: 1 feel: make feel [
engage: [
n1: n1 + 1
a1/text: to-string n1 show a1
]
]
]
a2: text to-string n2 100 rate 10 feel [
engage: [
n2: n2 + 1
a2/text: to-string n2 show a2
]
]
button "Quit" [unview]
]
[6/6] from: carl:cybercraft at: 27-Apr-2001 22:02
On 27-Apr-01, Renaud wrote:
> you can use a different (simpler) syntax to achive the behavior you
> want. se below te a2 definition, wich is a shorter way to set the
> same feel facet.
Thanks Renaud, that's quite a bit nicer. I'd never really got my head
around how 'feel works and have just pruned back other's code as much
as possible while still keeping its functionality. Looking forward
to the full View docs...
> rebol []
> n1: 0
<<quoted lines omitted: 17>>
> button "Quit" [unview]
> ]
--
Carl Read
[carl--cybercraft--co--nz]
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted