AltME: R3-GUI

Messages

Bo
NickA and Gabriele: Thanks a lot! It's amazing how much knowledge you all have. :-)

Bo
Next thing I want to try is to resize an image in R3-GUI. I'm trying the following which isn't working:
view/no-wait/options [
    box 240x320 black
    y: image %img/eye1.gif 20x20 with [facets: [max-size: 20x20 min-size: 20x20]]
    z: image %img/eye1.gif 20x20
][offset: 0x0 flags: [no-title on-top]]
It is displaying the image in full size.
In VID, we used to be able to do this:
view/new layout/size [
    across
    background black
    y: image %img/eye1.gif 20x20 effect ['fit]
] 240x320
Things seem much harder in R3-GUI.

DocKimbel
I am doing some tests with Saphirion's R3-GUI (as I cannot figure out how to run Carl's GUI). What's wrong with this code:
>> view [b: button "hello"]
** Script error: layout word is not bound to a context
** Where: if view
** Near: if block? window [
Ok, got it:
>> load-gui
Fetching GUI...
>> view [button "hello"]
== make gob! [offset: 890x562 size: 140x34 alpha: 255 text: "REBOL: untitled"]
Where does `load-gui` store the loaded code? I can't find it in system/view and system/view/VID seems to be gone in R3...
Pekr
Carl's GUI is different. Not sure it will work with Saphir's code?
DocKimbel
If I say that I'm lost in the R3 GUIs ecosystem, I guess it would feel familiar to others. ;-)
Actually, I just wanted to have a look at how R3 implements a style, especially how actors are stored. In Carl's docs, they seemed to be stored in a block, I just wanted to check in the code if that was the case for real or not.
Pekr
>> source load-gui
load-gui: make function! [[
    "Download current GUI module from web. (Temporary)"
    /local data
][
    print "Fetching GUI..."
    either error? data: try [load http://www.rebol.com/r3/gui.r] [
        either data/id = 'protocol [print "Cannot load GUI from web."] [do err]
    ] [
        do data
    ]
    exit
]]
>>
ok, can feed you some docs ....
There are Carl's GUI docs, which implement actors, reactors, and then public Github repo of Saphir docs, which cancelled reactors ...
DocKimbel
I want to check the source code, not the docs.
Pekr
ah ...
DocKimbel
I decompressed the GUI sources from the rebol.com link, so at least I can have a look now. :-)
Pekr
I have somewhere even Gabriele's GUI :-)
What I like about the R3-GUI is on-* actions ...
You can look into Saphir's docs here .... (even that I know you prefer sources :-) http://development.saphirion.com/rebol/r3gui/
I like how facets, options are separated, as well as actors, and whole style is drawn using a draw dialect ...
Pekr
So, I hope we get nice code patterns like follows:
stylize [
    my-progress: [
        about: "Progress bar."
        facets: [
            size: 200x22
            max-size: 1000x22
            edge-color: 96.96.96
            area-color: 80.80.80.128
            area-fill: span-colors area-color [.3 .5 1]
        ]
        options: [
            bar-color: [tuple!]
            size: [pair!]
        ]
        faced: [
            bar-color: teal
            bar-size: 1x1 ; modified by the progress % value
            bar-fill: ; generated from bar-color option
        ]
        draw: [
            pen edge-color
            line-width 1.5
            grad-pen 1x1 0 20 90 area-fill
            box 1x1 area-size 3
            grad-pen 1x1 0 20 90 bar-fill
            box 1x1 bar-size 3
        ]
        actors: [
            on-make: [
                face/facets/bar-fill: span-colors
                get-facet face 'bar-color [1.0 1.5 .6]
            ]
            on-set: [ ; arg: event
                ; Update the bar size from the face value.
                face/state/value: arg/2
                v: clip-face-val face
                size: get-facet face 'area-size
                face/facets/bar-size: as-pair v * size/x size/y
            ]
        ]
    ]
]
view [
    prog: my-progress
    button "Set 50%" set 'prog 50%
]

Last message posted 38 weeks ago.