Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 03 2017 05:53
    @PeterWAWood banned @matrixbot
  • Sep 28 2016 12:19
    @PeterWAWood banned @TimeSeriesLord
  • Aug 13 2016 03:23
    @PeterWAWood banned @Vexercizer
view [
    style small: area 30x30

    button button button return
    button button button return
    area below small small small
]
GiuseppeChillemi
@GiuseppeChillemi
Small should be on the right of 300x500
area
Vladimir Vasilyev
@9214
Okay, now go on and fix it :wink:
GiuseppeChillemi
@GiuseppeChillemi
@9214 I'll look at It in few minutes. Those were my last words before falling asleep , written in my bed.
I still have bit seen the result of your examples
*still not seen
ne1uno
@ne1uno
@GiuseppeChillemi you can use a group-box to make some layout simpler, I don't think you can turn off the border though
GiuseppeChillemi
@GiuseppeChillemi
@9214 I have tried and it works. Now I have started experimenting.
It seems when you draw a face the cursor is moved just after it. So, if you write BELOW and you have draw the last on as ACROSS, then you have CURSOR LEFT - DRAW - CURSOR DOWN DRAW
GiuseppeChillemi
@GiuseppeChillemi
Is there a way to TRIGGER the default event connected to a face ?
GiuseppeChillemi
@GiuseppeChillemi
@toomasv @9214
Thanks for your help. I have just published the first working version: https://github.com/GiuseppeChillemi/textsplithelper.red/blob/master/TextSplitHelper.red
Attribution inside
This my first ever code published on GITHUB.
I will use this software to catalog all my notes.
But has many other applications when splitting text lines to corresponding categories
(user defined inside the script, visually on newer releses)
Toomas Vooglaid
@toomasv
@GiuseppeChillemi :+1:
@nedzadarek My turtle here:
turtle
Or is it bug?
nedzadarek
@nedzadarek
@toomasv are you trying to draw a square and are you using my (edited) code? If yes then it should work for square because after each line we rotate by 90 degree so <center> parameter ( (optional) center of rotation (pair!)) doesn't matter. We should calculate <center> parameter other way.
Toomas Vooglaid
@toomasv
@nedzadarek Neither. It's my code and turtle is drived by arrow-keys where-ever needed.
nedzadarek
@nedzadarek
@toomasv so what's the bug? It seems to move correctly (we don't know the key-presses) and it just goes off-screen (that's normal).
Toomas Vooglaid
@toomasv
@nedzadarek Sorry, I meant that it looks rather like a bug. But on closer inspection it is clearly not a bug. :smile:
nedzadarek
@nedzadarek
@toomasv oh :D Well, to me it looks like a turtle. It walks (slowly) as a turtle... so it must be a turtle.
Gregg Irwin
@greggirwin

@toomasv :^)

@nedzadarek Maybe not useful but: https://github.com/greggirwin/R2-ReboLogo

nedzadarek
@nedzadarek
@greggirwin :+1: I have yet to understand syntax but it is not far from the Rebol/Logo.
You once mentioned the Logo. I thought I would try it as a programmer (I have seen it when I was young). It has very easy syntax but it is capable of doing amazing things, even by accidents. Non-programmers can learn how to program and programmers can use it for building fractals, space-filling-curves etc.
What do you think about extending draw/shape of the Logo's features (rotation/heading, loops, conditions, functions etc)?
GiuseppeChillemi
@GiuseppeChillemi
Hi, which are the corresponding events in VID for:
Right Mouse Button
Middle mouse Button
Wheel rotation ?
dsunanda
@dsunanda
All the event names are listed here: event names - just remember that the name in the code block is ON-xxx where xxx is the listed event name.
Gregg Irwin
@greggirwin
@nedzadarek we could implement a separate drawing dialect, that works like the Logo turtle, but should probably keep draw as it is, since the two paradigms are quite different. For example, DRAW is strictly declarative, while the turtle commands are not.
Logo is almost just Lisp without the parens. Brian Harvey wrote a 3 volume series about it: Computer Science Logo Style.
nedzadarek
@nedzadarek
@greggirwin It is interesting. So, we would call draw and that dialect like view base draw[draw code]logo[logo code]?
Gregg Irwin
@greggirwin
You could easily compose things in that way for static drawings, but the real use of the turtle in logo was as a more interactive tool for thinking and learning. Draw is static while watching the turtle move and draw is a big part of that experience, which means your Logo drawing commands are really tied to a timer of some kind. What we could do, then, is set a canvas face for the turtle commands, and as you run them, the draw block for that face would be updated, so the Logo part is in control there.
nedzadarek
@nedzadarek
@greggirwin Interesting - thank you for the response.
lepinekong
@lepinekong_twitter
@nedzadarek of course I had seen any-type and block in help. My point is I contest this design choice as a condition is semantically one thing so there's no reason to have 2 different sets for value.
lepinekong
@lepinekong_twitter
@nedzadarek @toomasv I'm looking too for teaching kids programming. Is there code somewhere ? It seems much more difficult to do in Red than in Scratch especially the tortoise moving her legs ;)
Toomas Vooglaid
@toomasv
@lepinekong_twitter Walking turtle code
nedzadarek
@nedzadarek
@lepinekong_twitter I see, that's what you mean. Let's take it from a different angle. You have while that checks a condition every time (before entering body block) and you have if that need to check it once. You need a block to run code multiple times so if doesn't need it.
It's nice design choice. It tells you if the code will be run multiple times (or it will be passed as code/data).
nedzadarek
@nedzadarek
As for kids: I don't know if there is such code. I think the vid is not in the final state. I find some solution not easy/straight forward. I think it need some polishing.
DavidConroy
@DavidConroy

; Hi, newby question about contexts. I want to be able to set values in the do-block of a button, but I'm
; got "word not bound to context" error:

f: function [] [ return view/no-wait [ button "test" [ x: "hello" ] ] ]
; -> error: word not bound to context

; I tried two workarounds, setting the values in an options block passed to face,
; and setting the values in a context, but I'd like to know if there is a way
; to carry out my original intentions using bind or something. I believe the
; error is something to do with anonymous functions in the dialect not
; having a context?

; Set data in face options

f: function [] [ return view/no-wait/options [ button "test" [print face/parent/data/x] ] [data: [x: 100]] ]

; set data in created context

f: function [] [ return context [ x: "hello" init: view/no-wait [ button "test" [ print x ] ] ] ]

; Thanks!

Toomas Vooglaid
@toomasv
@DavidConroy function makes all set-words found in function's body local by default. To have x in global context use func instead:
>> f: func [] [ return view/no-wait [ button "test" [ x: "hello" ] ] ]
== func [][return view/no-wait [button "test" [x: "hello"]]]
>> f
== make object! [
    type: 'window
;...
>> x
== "hello"
Semseddin Moldibi
@endo64
Or use /extern refinement in function: f: function [/extern x] [ return view/no-wait [ button "test" [ x: "hello" ] ] ] so x would be set in global context.
nedzadarek
@nedzadarek
@DavidConroy not sure if it's a bug or not but /no-wait seems to be a culprit.
f: function [] [return view [do [x: none] button "test" [x: "hello" probe x]] ] vs g: function [] [return view/no-wait [do [x: none] button "test" [x: "hello" probe x]] ] both has x as local (?? g) but only 2nd one doesn't work.
DavidConroy
@DavidConroy
That's perfect thanks @toomasv, @endo64, @nedzadarek ... I "knew" that about func, but didn't make the connection. Also I didn't realise you could selectively extern function variables. As for the "no-wait" solution, I have no idea... Cheers
Vladimir Vasilyev
@9214
@nedzadarek /no-wait is not the culprit. In the first case f calls view and waits until it finishes, and x has its context available because we're using it during f call. In the second case you explicitly ask to not enter View event loop, so you instantly get face object back, which has x in it bound to f. Problem is that f is gone, since function call was just finished. Hence the error message.
And I suspect that @DavidConroy uses stable build, because it was long ago patched to "context for x is not available", which is more accurate.
DavidConroy
@DavidConroy
That's right, stable build.
Is the development build recommended?
Vladimir Vasilyev
@9214
@DavidConroy currently yes, because "stable" one is almost a year old.
And perhaps what you're looking for is f: does [...].
lepinekong
@lepinekong_twitter
@nedzadarek ok thanks but seems to me it is more an internal reason to red that leaks to outside whereas outsiders don't care except by consistency from their own viewpoint ;)
nedzadarek
@nedzadarek
@9214 I see.
@DavidConroy I think you need to test it. I have been using non-stable version from 26-Mar-2018 because newer version had memory leak and high cpu usage. Red 0.6.3 for Windows built 22-Oct-2018/19:39:48+02:00 commit #d3c8c4f seems to be "stable" enough but I need to test it more.