Red Programming

Red programming language
         This page was last updated:  14/07/2017
I've been looking at this language and I have to say that it IS the future. It puts all of the over bloated resource hungry programming environments to shame.
Red is a single exe, less than one meg in size and needs no dependencies. Red is definitely the way programming should be .... See my Red Apps.
Very similar and inspired by the excellent 'Rebol' scripting language, Red seems to deliver everything a developer needs. You write one script and it runs on/compiles to every platform .... An App developers dream. Though still in its early stages of development, I would say it is already a powerful programming tool. I love it. 
I must congratulate the brilliant 'Nenad Rakocevic' and his devoted team of developers. The amount of work and the dedication needed to get Red to where it is now is awesome.  I must also convey the highest regard and respect to these programming guru's .... 

To get it, go to the Red site: and download the last stable build. The site has plenty of instructions and tips.  

I use Windows, so will show how to get started in Windows .... So:  'Create a new folder' call it 'Redthings'  .... now copy the red-063.exe to your 'Redthings' folder. there are a few ways to interpret and/or compile Red scripts .... but for now all you need is a text editor .... Any text editor will do, but lets make things easy .... If you go to:  and move down to 'Try Ride for Windows' then click on 'you can download it here ' .... then unzip into your 'Redthings' folder and away you go. 

Alternatively you could try my simple 'Red' editor with built in interpret and compile options, No setup needed, just unzip and go ....  Simple, No Nonsense .... Write, Interpret and Compile ..... Get it here: 

Check out the examples below and See my Red  'Beginners Reference Guide' for more.

Also typing 'what' at the Red console prompt will give you a list of all Functions.

You can cut and past these examples into your editor:

;example 1:
Red [needs: 'view]
view [ text "Hello World !"]

;example 2:
Red [ Title: "my program"  needs: 'view]
view [ text "Its a great big world !"  button "Quit" [quit] ]

;example 3:
Red [needs: 'view]
view [backdrop yellow  t: text  yellow "Hello World !" 
 button "Click" [t/text: "Red is good !" ] 

;example 4:
Red [needs: 'view]
view [title "Save my notes"
    t: text ""
    a: area 
    button "Save" [save %notes.dat a/text    t/text: "Saved"]

;example 5:
Red [needs: 'view]
view [title "Load my notes"
    t: text ""
    a: area 
    button "Load" [a/text: load %notes.dat   t/text: "Load"]

;example 6:
Red [title: "Draw Lines" needs: 'view ]
view [ 
    base black 500x300 draw[ pen yellow line 0x150 500x150  
                             pen yellow line 250x0 250x300 
                             pen red line 0x0 500x300 
                             pen red line 0x300 500x0  ] 

;example 7:
Red [ needs: 'view ]
view [title "field test"
      t: text font-color purple "" 
      name: field 
      button "<-- Enter Something and Click" [t/text: name/text]

;example 8:
Red [title: "simple animation"  needs: 'view]
view/no-wait [backdrop cyan size 460x450  t: text font-size 16 font-color red cyan "Hello"]
loop 100 [
    t/offset: t/offset + 4x0   ;;;; move across
    loop 1 [do-events/no-wait wait 0.03]   ;;;; control the speed  
    t/offset: t/offset + 0x4   ;;;; move down

;example 9
;;;; See my   'red programmers Guide'   for more help. 
Red [ title: "Time" needs: 'view]                                       
tim: append form  "Time: " now/time        ;;<-- set tim variable with time
;; stay on top and just show the close button ;;
flags: clear []
       append flags 'modal
       append flags 'popup                          ;;<-- I think popup only works for Windows
;;;;;;;;;;;;;; open the main view ;;;;;;;;;;;;;;;;;;
view/flags [ title "Red Time"
       tim: text font-size 14 font-color red tim
       rate 1 on-time [tim/text: append form  "Time: " now/time]
       ]flags                                                   ;;<--  end main view
You'll need  Red ver: 0.6.1. or later to try this one.

You can get the .exe ready compiled here:Red Apps
download Red version 0.6.2 or later from here:

;example 10
Red [needs: 'view]
view [title "Drop-List"
    t: text "Choose and click ->"
    drop-list data ["You" "Me" "Us" "Them"] 
    [t/text: pick face/data face/selected]
      ]  ;;<--end view

;example 11
Red [needs: 'view]
view [ backdrop brown
    Title "Tab-Panel Example"
    tab-panel 200x100 [
        "Tab 1 " [at 30x30 text font-size 16 font-color red "Panel 1 ...."]
        "Tab 2 " [at 30x30 text font-size 16 font-color blue "Panel 2 ...."]
        "Tab 3 " [at 30x30 text font-size 16 font-color green "Panel 3 ...."]

;example 12
Red [Title: "Draw test" needs: 'view ]
;; circle
 view [base 200x200 draw [pen yellow circle 100x100 40]]
;; square
 view [base 200x200 draw [pen red box 60x60 140x140]] 
;; triangle
 view [base 200x200 draw [pen blue triangle 60x110 140x110 100x50]]
;; polygon 
 view [base 200x200 draw [pen cyan polygon 100x60 120x120  60x140]]
;; box with fill-pen 
 view [base 200x200 draw [fill-pen red box 60x60 140x140]] 
;; circle with fill-pen
 view [base 200x200 draw [fill-pen yellow circle 100x100 40]] 
;; triangle with fill-pen 
 view [base 200x200 draw [fill-pen blue triangle 60x110 140x110 100x50]]
;; line with line-width set to 10
 view [base 200x200 draw [line-width 10 pen blue line 40x100 150x120]]

;example 14
Red [ needs: 'view ]
mm: layout [title "MyMenus" a: area cyan 200x200]
mm/menu: [
    "File" [ "Load" load --- "Save" sv --- "Save As" svas --- "Quit" qt ]
    "Tools" [ "Text Size" txtsz  ]
    "Help" [ "Some Help" hlp ]
mm/actors: make object! [
    on-menu: func [face [object!] event [event!]][ 
    switch event/picked [load [print "load"  a/text: "Load !!!!"]
                                    sv [print "save" a/text:  "Save !!!!"]
                                    svas [print "save as" a/text:  "Save As !!!!"] 
                                    qt [quit  ]            
                                    txtsz [print "Tools tab !"  a/text: "Tools tab !!!!"] 
                                    hlp [print "help tab !"  a/text: "Help tab !!!!"]
                                    ] ] ]        
view mm

;example 15
Red [needs: 'view
         title: "fonts"
view [below
      text italic "Hello"
      text bold "Hello"
      text font-color purple underline "Hello"
      text yellow "Hello"
      text font-color red "Hello"
      text font-size 16 "Hello"
      text font-name "comic sans ms" font-size 14 italic "Hello"
      text italic bold font-color green font-size 16 "Hello"

;example 16
;;;; See my   'red programmers Guide'   for more help. 
Red [needs: 'view]
view [title "Text-List"
    t: text "Click on a month ->"
    text-list 100x100 data[
        "January" "February" "March" "April"
        "May" "June" "July" "August" "September"
        "October" "November" "December"] 
    [t/text: pick face/data face/selected]
      ]  ;;<--end view

;example 17
;; display a 'slider' and a 'progress' and use 'on-change' to update progress data.
Red [ needs: 'view]
      view [title "slider, progress bar"
        slider 100x20 data 10% on-change [p/data: face/data]
        p: progress 100x20 10%        

;example 18
Red [ needs: 'view]
      t: "Hello World !"      
view [size 280x100  title "to binary! / to string!"
      g: text 250x50 t
      button "Binary" [b: to binary! t  g/data: b print b]
      button "String" [b: to string! t  g/text: b print b]

;example 19
Red [ needs: 'view]
;;;; get a keypress ;;;;
view/options [ t: text "hit 'space', 'x', or 'q' keys !"][
        actors: object [on-key: func [key event] [
        if event/key = #"x" [t/text: "'x' key pressed."]
        if event/key = #"q" [t/text:  "'q' key pressed."]
        if event/key = #" " [t/text: "'space bar'pressed."] 
         ]  ]  ]

;example 20
;;;; a bit more in this one, See my   'red programmers Guide'   for more help. 

 Red [needs: 'view]
    view [
    style txt: text                                                     
    group-box "My Group Box" 1  [origin 40x40        
         txt "Name" name: field 200
         txt "Address1" addrs1: field 200 
         txt "Address2" addrs2: field 200
    button "save" [save %mygroupbox.txt reduce [name/text addrs1/text addrs2/text ] t/text: "*Saved*"] 
    button "load" [attempt [set [nm ad1 ad2]  load %mygroupbox.txt]  
         attempt [name/text: nm] 
         attempt [addrs1/text: ad1]  
         attempt [addrs2/text: ad2]  
         t/text: " *Loaded* "] 
         t: text font-size 16 font-color red "                "

;example 21
Red [needs: 'view]
view [title "Panels"  size 460x450
panel red [size 100x100 below text red "Panel one" check red  txt: text red ""]
panel blue [size 100x100 below text blue "Panel two" radio blue]
panel yellow [size 100x100 below text yellow "Panel three" text yellow font-size 18 "Hello"]
panel brown [size 100x100 below text brown "Panel four" 
                            button "do something" [txt/text: "Did Something"]]
at 200x20 panel cyan [size 200x400 below text cyan "Panel five" field area 
                            t: text "Some text here."    drop-down progress 40% slider 
                           button "3 Second Quit" [t/text: "Quit in 3 secs ...." wait 3 quit]]

;example 22  
;;;; An image viewer - make sure you have some image files in the folder.
Red [needs: 'view]
folder: read %.
count: 0
foreach file folder [ 
    foreach ext [".jpg" ".gif" ".png" ".bmp"] [ 
        if find file ext [
        i: load file
        view/no-wait/options [title "Image Viewer" below    
        t: text font-size 12 "Click or Tap image>>"
        image i [unview]
                      ]   [actors: object [on-close: func [face event][quit]]]
        count: count + 1  
        t/text: append form "Click or Tap image> " count  
if count = 0 [view [text "No image files found !"]]


;example 23
Red [needs: 'view]
;; stay on top and just show the close button ;;
flags: clear []
       append flags 'modal
       append flags 'popup 
view/flags [backdrop purple
     title "MyCalculator"
     f: field brown 190x40 font-size 20 font-color white "" return 
     style b: button font-size 20 italic font-color red 40x40 
     [append f/text face/text]
     b "1"  b "2"  b "3"  b " + "  return 
     b "4"  b "5"  b "6"  b " - "  return 
     b "7"  b "8"  b "9"  b " * "  return 
     b "0"  b "."  b " / "  b "=" 
     [attempt [ansr: form do f/text append clear f/text ansr]] 

;example 24
;;Maximize/Resize a view
Red [needs: 'view]
view/flags [size 400x300 title "resize and max" text "Hello"] 'resize

;example 25
;; needs 'red-062.exe' or later.
Red [needs: 'view]
view [below h1 "Hello" h2 "Hello" h3 "Hello" h4 "Hello" h5 "Hello"]

;example 26
;; Sets focus to a face. If used on more than one face, only the last one will get focus.
;; in this example 'area' has focus.
Red [needs: 'view]
view [ area focus 200x200   f: field  80x25 ]

;example 27
Red [Needs: 'View]
view/flags [backdrop black size 400x80 
f: h1 blue font-color red "Red Programming !!" on-down [quit]      ;; click on text to quit
rate 1 on-time [either f/text = "" [ f/text: "Red Programming !!"] [f/text: "" ]  ] 
] 'no-title

;example 28
Red [needs: 'view]
 view [
base 500x500 draw [
pen off      ;; <-- get rid of border
fill-pen diamond 250x250 0 400 red green blue yellow purple cyan silver orange box 0x0 500x500

;example 29
Red [needs: 'view]
 view [
base 500x500 draw [
pen off      ;; <-- get rid of border
fill-pen radial 250x250 0 400 red green blue yellow purple cyan silver orange box 0x0 500x500

;example 30
;;;;A usable tiny Red editor and Interpreter in less than 10 lines of script
Red [needs: 'view author: Alan Brack]
view/flags  [title "Tiny Red Editor/Interpreter" below  t: text  "My Editor"  200x30  a: area 500x400  {Red [ ] 
          view/flags  [text "Hello World" ]'modal }   text ""  across
          button "Save" [if sf: request-file/save  [unless suffix? sf [append sf]  
          write sf a/text  t/text: "Saved." ] ]
          button "Load" [if Lf: request-file [a/text: read Lf  t/text: "Loaded."  ] ]
          button "Run" [ do a/text  t/text:  "Try some different code" ]
          button "Clear" [a/text: ""   t/text: "Try some more Red code" ]   ] 'modal

See my  Red Apps  for a far more advanced Red editor.

;example 31
;; you'll need the latest automated build to use 'set-focus'.
Red [needs: 'view]
view [below a: area focus 100x100  f: field  80x25 
          button "field"  [set-focus f  f/color: orange a/color: white] 
          button "area"  [set-focus a  a/color: orange f/color: white] 

;example 32
;; six triangles.
Red [needs: 'view]
view [title "Six Triangles" 
base 400x300 blue 
draw [pen red fill-pen yellow triangle 266x150 190x120 140x138 
fill-pen yellow triangle 214x220 140x138 145x174 
fill-pen yellow triangle 259x186 215x180 214x220 
fill-pen yellow triangle 259x186 266x150 215x180 
fill-pen yellow triangle 214x220 215x180 140x138 
fill-pen yellow triangle 266x150 140x138 215x180 ]  

;example 33
Red [needs: 'view   title: "A Mouse Click Thing"] 
t: 0
random/seed now/time   ;;;; seed the random generator 
v: View/no-wait/flags [ title "**** Click on it ****" backdrop red below  h1 font-size 18 "Click Me !!" on-down [unview view/flags [h1 "Success !!"]'modal ] 
rate 2 on-time [x: random 1400  y: random 800  oset: as-pair x y  v/offset: oset  t: t + 1  if t > 20 [unview view/flags [h1 "Failed !!" ]'modal ]]
] ['modal 'no-buttons]     ;;;; end of main view 
v/offset: 20x1000  
;;;; you could change 'rate 2'  to  'rate 1'  if you cant catch it.

;example 34
;;;;An alarm clock - I called  'user32.dll,MessageBeep'  to produce the alarm sound, I tested it on PC, ;;;;laptop and tablet with Win 7, Win 8.1, Win 10. without any problems.
Red [ title: "Alarm Clock" Author: "Alan B" needs: 'view]     
h2: -1  m2: -1                        
tim: append form  "Time: " now/time        ;;<-- set tim variable with time

;;;;;;;;;;;;;; open the main view ;;;;;;;;;;;;;;;;;;
view/flags [ title "Red Alarm Clock"
       tim: h3 font-color red tim
       rate 1 on-time [tim/text: append form  "Time: " now/time t: now/time 
if t/hour = h2 [ if t/minute = m2 [call "start/min rundll32 user32.dll,MessageBeep"]] ]  return
       text "------------------------------------" return  h4 font-color blue "Alarm ...."  ist: h4 italic font-color red bold ""  return
h: text 100x25 "Select hour ->"
text-list 45x25 data ["01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" 
"13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "00"] 
[h/text: pick face/data face/selected h2: to-integer h/text if h2 > -1 [ if m2 > -1 [ist/text: "  *SET*" ] ] ] return  ;;;;<--  select hour and to-integer it.
m: text 100x20 "Select minutes ->"
text-list 45x20 data ["00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" 
"15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" 
"35" "36" "37" "38" "39" "40"  "41" "42" "43" "44" "45" "46" "47" "48" "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59"]
[m/text: pick face/data face/selected m2: to-integer m/text  if m2 > -1 [if h2 > -1 [ist/text: "  *SET*" ] ] ]     ;;;; <-- select minute and integer it.
return  button "Stop/Reset" 180x20 [ if h2 > -1 [if m2 > -1 [h2: -1  m2: -1 h/text: "Select hour ->"  m/text: "Select minutes ->" ist/text: ""]] ]  
]['modal 'popup]                                     ;;<--  end main view

or see my 'Red Beginners Guide, here'  including plenty more examples.

If you need help, you are welcome to email me and I will try to help.

website counter