sorry for the time it took to reply,

I was trying to find a bug which in the end is not a bug... it had only
forgotten to create the pipe (in example B)...

----- Original Message -----
From: "Philippe Oehler" <[EMAIL PROTECTED]>
> Hi there,
>
> For those who hadn't read the concept of liquid, read it. That's great !

thanks!  all the effort is not it vain, then...  :-)

> I have a question. How can I connect VID elements (i should say Liquid
> Elements) to block of data that aren't VID elements ?

you must, of course, open the liquid library
and then, in the code, before or after building a liquid-vid layout, you use the
attach method to attach one valve to another valve's pipe.

example A:  valve created after

;----------------------8<--------------------------
rebol []

liquid: open-library 'liquid 0.0.5
lvid: open-library 'liquid-vid 0.0.5
lvid-style: lvid/style  ; because VID's layout does not support objects paths...

gui: layout [
    across
    styles lvid-style
    value-sldr: slider 200x20 min 1 max 100
    field attach value-sldr 50
]

valve: liquify liquid/valve! []
valve/attach value-sldr/valve  ;  attach this valve to that slider
valve/handle [
    print data + 20
]
valve/refill none  ; calls an update just on this valve with the pipe's current
value.

view gui
;-----------------------8<-------------------------
example B:  valve created before


rebol []

liquid: open-library 'liquid 0.0.5
lvid: open-library 'liquid-vid 0.0.5
lvid-style: lvid/style  ; because VID's layout does not support objects paths...

myvalve: liquify liquid/valve! [
    pipe/create
    handle [print data + 20]
]

view layout [
    across
    styles lvid-style
    fld: field 50
    value-sldr: slider 200x20 min 1 max 100 connect myvalve
]

;-----------------------8<-------------------------

both code snippets create exactly the same internal setup.

-From now on, any change to the slider is updated in the field, any change in
the field is updated to the slider.
-A print will ALSO be done (value + 20), everytime the value changes.
-The field is validated according to slider because it is attached to it.  Since
validation is persistent, entering a string in the field will reset the field to
zero (0).  Furthermore, because is uses a more flexible to-integer
(steel-utils/as-integer), you can write extra string data (like a %, $, ? even
words) and the numeric value in it will still be extracted... rebol's to-integer
would just crash. the code.

both examples can be further reduced, but it will make it harder to understand
so I left them like so.

HTH!


-MAx


-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to