AltME: R3-GUI

Messages

Cyphre
regarding the GIF loading...this is a bug in LOAD...I suspect it parses the URL for the image suffix at the end only so:
;this is not recognized filetype
LOAD http://i.stack.imgur.com/XgLe7.gif?s=128&g=1&g&s=32
;but this will be recognized as GIF filetype
LOAD http://i.stack.imgur.com/XgLe7.gif?s=128&g=1&g&s=32&.gif
Someone needs to fix LOAD parser or even add file type signature recognition to LOAD...

yoffset
This code doesn't call the draw dialect, and works.
Bck: make image! 500x500    
View/no-wait [image Bck]
    Draw Bck to-draw [
line-width 1 fixed
pen white
fill-pen blue
box 120x20 220x120
skew 15x15
fill-pen red
box 120x125 220x225
reset-matrix
skew -15x-15
fill-pen yellow
box 120x230 220x330
    ]
    copy []
    
Do-events
This code does call the draw dialect, and doesn't work, for some unknown reason.
ar: [
line-width 1 fixed
pen white
fill-pen blue
box 120x20 220x120
;skew 15x15
skew .15
fill-pen red
box 120x125 220x225
reset-matrix
;skew -15x-15
skew -.15
fill-pen yellow
box 120x230 220x330
    ]
view/options [
    tight [
    drawing ar
    ]
] [
init-hint: 600x650
]

yoffset
So I'm trying to figure a way to activate a break in a loop, to stop, from an exterior button press.  Seems a bit trivial but I'm not getting it.  Any suggestions?
GrahamC
yoffset
The toggle suggests another approach I hadn't thought about.  Thanks.
However, it doesn't solve my original problem.
Here is some obvious pseudo-code that doesn't work.  Any ideas/
num: 3
view [
    when [enter] on-action [
        while [num = 3] [
        print num wait 1
        ]
    ]
    button on-action [ num: 2 ]
]
GrahamC
All action blocks in r3-gui are closures.  Set-words will access the local context  only.  But when searching for a the value of a word, the system/contexts/user is searched after a word is not found in the local context..  So, the enter action block accesses num from system/contexts/user but the button action block is setting a new local of num to 2.  
To fix the issue, change num: 2 to set 'num 2, or system/contexts/user/num: 2
Ie. when the closure is created, the action block searches for set-words and creates locals.  This is the same as what we used to call 'funct, and now 'function
yoffset
system/contexts/user/num: 2  works.
I knew it was a closure problem, but I don't recall seeing this path in any docs.
Thanks.
yoffset
Well, that's interesting.
enter   ? system/contexts/user     and it looks like a handle on most everything.

GrahamC
Carl had a habit of writing blogs instead of formal docs
GrahamC
@Cyphre, I have a suggestion on implementing externs in action blocks
https://github.com/saphirion/r3-gui/blob/master/source/layout-dialect.r3#L80
change to:
extend-face last-face 'actors reduce either block? body/1 [
    extern: take body [act funct/extern/closure [face arg] body extern]
][
    [act funct/closure [face arg] body]
]
If one wanted it more literate, you could make it
on-action [ extern: [  list of external words ] rest of action block ]
What do you think?

Cyphre
Graham, you mean more like:
on-action [[  list of external words ] rest of action block ]
at least that's what the change does.
I'm ok with that change as it shouldn't break older actors code. It should be very rare to start actor with a block definiton.
Anyone else here who is against that change?
Cyphre
yoffset: regarding "his code does call the draw dialect, and doesn't work, for some unknown reason." - yes, that's a bug. The SKEW command arg syntax changed (form decimal! to pair!) in the late aplhas but the parser definition remained old in one place.
I uploaded the fix to github and also made new build so LOAD-GUI should give you correct behaviour as well.

Bo
Back in the old days on Rebol2/View, it was possible to do something like this:
    save/png %myimage.png to-image layout [box 100x100 green text "Hello World!" image %flower.jpg]
I just tried something like that on Rebol3/View, and I get:
    >> to-image layout [text "Test"]
    ** Script error: object! type is not allowed here
    ** Where: to to-image
    ** Near: to image! :value
Is there a different way of doing this?
Cyphre
yes, you can do it like:
lay: layout [text "Test"]
write %layout.png encode 'png to-image lay/gob
Andreas
And instead of the `write %layout.png encode 'png ...` you should also be able to use just `save %layout.png ...`.
Cyphre
yes, using SAVE is shorter :)

Bo
Great!  This is going to help with the ability to display GUI elements and graphics on the ODROID-Show module (320x240x16 screen controlled through USB - retail price $25).  I've written a dialect to make using the screen easier via the text-based commands, and wanted to add a component to get the graphics to work as well.

Last message posted 261 weeks ago.