• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp0
r3wp98
total:98

results window for this page: [start: 1 end: 98]

world-name: r3wp

Group: Ann-Reply ... Reply to Announce group [web-public]
DideC:
13-Jun-2005
Pekr: Area with automatic scrolling. What do you mean ?  While selecting 
text by mouse ?

I yes, there is area-scroll-style demo in the library http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=area-scroll-style.r

It's fairly a demo because it works on most version. But it would 
be smaller for 1.3 (as there is patch in it for old versions).
Group: !AltME ... Discussion about AltME [web-public]
PeterWood:
31-Mar-2005
1. Improved scrolling so that clicking on scroll arrows does not 
skip past text as now.
Chris:
21-Jul-2006
I see the problem as this:

* Line and Page steps should be fixed units, based on text line height 
and containing face height respectively.

* The position of the 'thumb' in the shaft should be determined by 
the position of the content relative to the container, not vice-versa 
(only exception is when dragging the 'thumb').

* Clicking on the empty shaft area should page scroll, the arrows 
should line scroll.
mhinson:
30-May-2009
Sunanda, thanks for the link. I had a good read of that and was surprised 
to not find any requests for keyboard shortcuts, paticularly the 
use of the arrow keys to scroll lists & text.. That would be my top 
request I think.
Anton:
17-Nov-2010
Bug:

The old inconsistent bug of failing to copy the text of a message 
by simple right-click prevented me from copying Oldes' message with 
the long referrer link and cookie data in it, so I selected the message 
text first before right-click. That worked, but then all messages 
in the display began disappearing (looks like a shared para scroll 
bug). Even switching groups. Right now I'm looking at !AltME with 
several blank messages - only the dates appear normally.
Group: Core ... Discuss core issues [web-public]
RobertS:
1-Apr-2008
Diss'ing IDE's might alienate some Smalltalk folk.  I cannot imagine 
maintaining an application suite such as I deal with everyday without 
an IDE.  I just wish it was not eclipse ...  Of course only wimps 
used a Disk Operating System and real men code in machine codes only 
... and real pro's dictated their SNOBOL punch cards to lovely assistants 
...  and ANT scripts are for sissies.  Some must have ridiculed Tcl, 
Expect and TK in their day ... but if my IDE can facilitate my efforts 
to systematically (key word there) shrirnk company''s codebase as 
it becomes more reliable with better test coverage then maybe a refactoring 
browser would be a good tool after all.  Even better if it is an 
integrated part of the IDE, as in Dolphin Smalltalk or Squeak Smalltalk 
or Smalltalk/X or Cincom Visual Smalltalk.  Not that I couldn't survive 
on grep and diff's.  But once the codebase is too large for any one 
person to author or maintain on their lonesome, a tool that remebers 
what you did last and where can be a god-send.  If you want to know 
hell without an IDE join an actuarial department working in APL. 
 There you don't even know if they have talent: you just hope most 
of it works as each quarter rolls around and try to survive year-end. 
 But you know they're smart, cuz after all, they're actuaries - and 
look at all that APL code in all those files ... of course a few 
of them look back wistfully at their student days in C with Borland's 
decent IDE.  REBOL [
    File: %vid-usage.r
    Date: 09-Jan-2004   
    Title: "VID Usage"
    Purpose: "VID Usage Tutorial with Runnable Examples"
    Version: 1.2.1
    Author: "Cybarite"
    Edits: RobertS
    Source: {
        Based on %easy-vid.r by Carl Sassenrath.

        Clips from various sites including email that are attributed in the 
        section
        }
    library: [
        level: 'intermediate
        platform: 'all
        type: [tutorial]
        domain: [gui]
        tested-under: [view 1.2.8.3.1 on W2K]
        support: none
        license: none
        see-also: none
    ]
]
 
flash "Fetching image..."
read-thru/to http://www.rebol.com/view/demos/palms.jpg%palms.jpg

read-thru/to http://www.rebol.com/graphics/reb-logo.gif%rebo-logo.gif
read-thru/to http://www.rebol.com/view/bay.jpg%bay.jpg
pic: %palms.jpg
unview

customer: make object! [  ; this sets a default customer object in 
case the user does not push the samples in order
        name: "Rosetta Stone"
        date-of-birth: 14-March-1959        
]

stylize/master [text-note: txt maroon bold]         ; this sets a 
default for users who run the samples out of order
; polished is an image that is embedded in this script file
; so that no outside files need to be loaded.
; This technique is used in many of the REBOL samples

polished: load #{      
89504E470D0A1A0A0000000D49484452000000670000003808020000006FFB71
8C0000001374455874536F667477617265005245424F4C2F566965778FD91678
0000039B49444154789CCD9BD14E2B310C44F3FFFF521E2AC1C395E00589EF02
5DD8D226713C339EECBD928510A4893D3EF67AB76D7B7E79FEB2D73FAFBDBD1D
36FEEBAF7DBF70FEDABABD0D56F0E1B6E0B6FED7AE81050B2E4F97AF9FED6185
45022048CA2C6920361F1336580B35A63C4E4F12808D378124CE9C81880B186C
14175A1DE9C0C2A2E785B6B64CA62EF6C626330250A932064CB984F3358FA77F
BC7F8CD657685E5FB03415A34B9E3226C1484A1ACA6DB6974597699EFB6C2F4E
C44B92E17454A309F14F348DDD4D5B98195BB2AF6B7E4E545B57FEBAE0415DA0
43EFE62C70B196362285D74C35F0782ECF26A0FC8492E20EAAED6CC35ACE13FC
61646467C69D5715EA4F9D3725B1703BF45AB2768A9D5F59CA6E716E5A747CBF
23D6A7E418C2C53C6EB440FCE803B106E6D94C8AAF4B42694871B9FB237035C8
70E5A0200D4A7E4553E952A6F435BA247DD4B83A5DB18D26AA4D5E39E0CA4107
7B0F86C7F19EC685B5EFE57D28E02E411CC2238C0304B5065D26DCC1DA9A02FC
CE4EBD19A0C58D9BE039179086B6DB20519A1F5C8194071DBB115703B996FF37
4BE0F5AA269B18CFC9C6CC1FC3D5A0D6B62C6AEA112236F38195B88DF12F9C9B
B45B1C6C637B161E1D5BCF6D8807A0437366CB21D90462F2BD3E827C96CB0483
D67B99916407E99E69FD12F46A50C973856268A5DC345259837D8827E00FF890
452D0B5D0D38932F3C65B9614B4F720901B96565DCCBD7236B7C66B650868D08
9BFA26EBB36DCAA5E3B120339E5EBE3B468E6B68FB3041E79229047367ADDC14
F7B376F26B2722024A41998813A04CB91A475C11C9054536473CA3F7365C0D30
9E65A0BA6D5977CFEE030BD626B9E2E5DFE76E51AFF9CADA6308F899C76E756A
03D4796E80532E986D273B71CEA8D81672739E0F1B329F8E999D0D9D04080769
CABC1D21260C2BB8E43D2A9D70BE3A2207D66EA09E5BCAFFB742F9F0A0C37677
222CFE9B7C2865192B3FAC5988E0385747334BD8288041E0DFBF4F2AD44804B4
6DADAF2BE98C5D02458059B3571CA91481B09580A9D6E827B184DD3756D6BF7E
7376F81ED59E46633384296A9A4BA7D4E3B8CBD3E566F1948B754731E0EBC41B
246774BD7BBBCA612D8CA7CC85A7C1ED093B75721DCED1D7E279871668830AE7
B782F5E9FDE4918360C9F666A6F61647F2EDB342A2FA3F6E9B0C8AC2699B9B3F
53847BB992B5707FDE5B6D721EA3EB55E3D8190D8BD998923A68917BE3FEDD32
EE1BDCA216275C1CCFBD0A07F35A40A6CC05A1357E6BF512D26DC470BAC927A3
B0078A42DD22E10000000049454E44AE426082
}
content: {VID Usage - REBOL Visual Interfaces


===Updates

--01-Apr-2008


* Fixed oddity with last item on stylesheets which was locking up 
some versions of VIEW

---09-Jan-2004

* Fixed slider initialize. 

* Focus section was not parsed out. --- fixed

* Fixed some text errors for the parsing of ===


---07-Jan-2004

* Revived vid-usage.r 

* added more examples from the script library

* manage source as vid-usage.leo an outliner file

---12-August-2001

Added supply examples. See:

!List/Supply

!List With Supplied Data

!Supply List With Scroll

---13-August-2001

!Add Subpanel example ported by Anton

===Caveats

---Work In Progress


This is a work in progress. Whether the progress will continue depends 
on the feedback.

---All Rights Reserved


The work is based on the documentation of REBOL View provided by 
REBOL Technology and its mailing list.

All rights to this documentation remain the property of REBOL Technology.

---Plagiarized Examples


Things are shamelessly plagiarized.  There are many experts on the 
mailing list whose work is included here; most notably the examples 
from the REBOL documentation.

---Approach


The approach that this document uses is to use REBOL/View/VID to 
demonstrate its abilities and give a visual tutorial. To enable this 
some changes have been made to the core %easyvid.r program from Carl 
Sassenrath. A scoll bar was added to the right pane because it was 
just too difficult to constrain the examples to the screen real estate 
that was available.

---Order Order


The order of the items needs some work. The easyvid presentation 
approach today does not allow for the drilling down and expansion 
of an outline tree which is needed for a large amount of documentation.


The preferred approach is to put a multi-level tree for navigation 
purposes and then allow navigation up and down the tree. 


===To Do

* make this a true outline tree

* re-organize it better


* update as requested and as possible by suggestions on AltME's REBOL 
world under group EasyVID

* correct numerous flaws


* better scrolling implementation using the updates that have been 
used in other examples such as Didier's %delete-email.r


* allow clipping to clipboard like AltME does on a row for the source 
examples




===Introduction to VID

With REBOL/View it's easy and quick to create your own user
interfaces. The purpose of this tutorial is to teach you the
basic concepts or REBOL/View interfaces in about 20 minutes.

VID is REBOL's Visual Interface Dialect.  A dialect is an
extension of the REBOL language that makes it easier to express
or describe information, actions, or interfaces.  VID is a
dialect that provides a powerful method of describing user
interfaces.

VID is simple to learn and provides a smooth learning curve from
basic user interfaces to sophisticated distributed computing
applications.


---Creating VID Interfaces

VID interfaces are written in plain text. You can use any text
editor to create and edit your VID script. Save your script
as a text file, and run it with REBOL/View.

!Note: Using a word processor like Word or Wordpad is not
recommended because files are not normally saved as text.
If you use a word processor, be sure to save the output
file as text, not as a document (.doc) file.


Recommendation: Look at TextPad from http://www.textpad.com




===Minimal VID Example

Here is a minimal VID example.  It creates a window that
displays a short text message.  Only one line of code
is required:

    view layout [text "Hello REBOL World!"]

You can type this line at the REBOL console prompt, or save
it in a text file and run it with REBOL.  If you save it
as a file, the script will also need a REBOL header. The
header tells REBOL that the file contains a script. Here
is an example of the script file with a header:

    REBOL [Title: "Example VID Script"]

    view layout [text "VID Example!"]

You can also add buttons and other gadgets to the script. The
example below displays a text, list of files, and a button:

    view layout [
        h2 "File List:"
        text-list data read %.
        button "Great!"
    ]

!Click on the examples above to see how they will appear on your
screen.  Click on their close box to remove them.  All of the
examples that follow can be viewed this way.


===Window Management


The code that displays the examples also shows how to manage the 
number of windows that are open.


Look at the show-example block in the code near the end of this script.


The location of the example window is also managed here by keeping 
track of the co-ordinates for the sample. After the sample window 
is moved, the next use will open at the same location.



===Pre-loaded Images


For this script, the image which represented a Portable Network Graphic
definition of an image is held in the script and loaded.


For a small number of graphics, this can achieve some packaging and
performance benefits.


The image "polished" is used through the script to achieve the polished 
steel
look that is one the outer frame.

    backtile polished orange
    button 200x50 "Polished Steel Look" polished 


===Two Basic Functions

Two functions are used to create graphical user interfaces
in REBOL: VIEW and LAYOUT.

The LAYOUT function creates a set of graphical objects.  These
objects are called faces.  You describe faces with words and

values that are put into a block and passed to the LAYOUT function.

The VIEW function displays faces that were previously created by
LAYOUT. The example below shows how the result of
the LAYOUT function is passed to the VIEW function, and the
interface is displayed.

    view layout [
        text "Layout passes its result to View for display."
        button "Ok"
    ]

Click on the above example to view it.

!Note: the block provided to a layout is not normal REBOL code,
it is a dialect of REBOL.  Using a dialect makes it much easier
to express user interfaces.



===Styles

Styles describe faces.  The examples above use the text and
button styles to specify a text line and a button. REBOL has
40 predefined face styles. You can also create your own custom
styles.  Here are a few example styles:

    view layout [
        h1 "Style Examples"
        box brick 240x2
        vtext bold "There are 40 styles built into REBOL."
        button "Great"
        toggle "Press" "Down"
        rotary "Click" "Several" "Times"
        choice "Choose" "Multiple" "Items"
        text-list 120x80 "this is" "a list" "of text"
        across
        check
        radio radio
        led
        arrow
        below
        field "Text Entry"
    ]


The words like backdrop, banner, box, text, and button are styles.

===Facets

Facets let you modify a style.  For instance, you can change the
color, size, text, font, image, edge, background, special
effects, and many other facets of a style.

Facets follow the style name.  Here is an example that shows
how you modify the text style to be bold and navy blue:

    view layout [txt bold navy "Facets are easy to use."]

The words bold and navy are not styles.  They are facets that
modify a style. Facets can appear in any order so you don't
have to remember which goes first.  For example, the line
above could be written as:

    view layout [txt "Facets are easy to use." navy bold]

Many facets that can be specified.  Here is an example that
creates bold red text centered in a black box.

    view layout [txt 300 bold red black center "Red Text"]

You can create facets that produce special effects, such
as a gradient colored backdrop behind the text:

    view layout [
        vtext bold "Wild Thing" effect [gradient 200.0.0 0.0.200]
    ]

===Custom Styles

Custom styles are shortcuts that save time.  When you define a
custom style, the facets you need go into the new style.  This
reduces what you need to specify each time you use the style,
and it allows you to modify the look of your interface by
changing the style definitions.

For example, here is a layout that defines a style for red
buttons.  The style word defines the new style, followed by
the old style name and its facets.

    view layout [
        style red-btn button red
        text "Testing red button style:"
        red-btn "Test"
        red-btn "Red"
    ]

So, if you wanted to create a text style for big, bold,
underlined, yellow, typewriter text:

    view layout [
        style yell tt 220 bold underline yellow font-size 16
        yell "Hello"
        yell "This is big old text."
        yell "Goodbye"
    ]


===Master Stylesheet 

REBOL holds its styles in a master stylesheet. When you are
sure that you want to share them without having to add the
style sheet line then do it as follows:

First add the style to the master sheet:

    button 200x50 "Define text-note as maroon bold text" [stylize/master 
    [
        text-note: txt maroon bold      
    ]]

    button 200x50 "Define text-note as white italic text" [stylize/master 
    [
        text-note: txt white italic     
    ]]

Then invoke it:

    view layout [
        across
        size 200x200

        return text-note "This shows a master stylesheet style in use." 

        return text-note "This shows another usage of the same style."

        return text-note "If you want to see the other style displayed, click 
        the Add Style section again and then use the other button"
    ]
    
    
===Note About Examples

!From this point forward, all examples will assume that
the view and layout functions are provided.  Only the layout
block contents will be shown.  To use these examples in your
scripts, you will need to put them in a layout block, as was
shown earlier.

For example, code that is written as:

    view layout [button red "Test it"]

will now appear as:

    button red "Test it"


===Face Sizes

The size of a face depends on its style.  Most styles, such as
buttons, toggles, boxes, checks, text-lists, and fields, have a
convenient default size.  Here are some examples.

    button "Button"
    toggle "Toggle"
    box blue
    field
    text-list

If no size is given, text will automatically compute its size,
and images will use whatever their source size is:

    text "Short text line"
    text "This is a much longer line of text than that above."
    image %palms.jpg

You can change the size of any face by providing a size facet.
The size can be an integer or a pair.  An integer specifies
the width of the face.  A pair specifies both width and height.
Images will be stretched to fit the size.

    button 200 "Big Button"
    button 200x100 "Huge Button"
    image %palms.jpg 50x50
    image %palms.jpg 150x50

===Color Facets

Most styles have a default color.  For example the body of
buttons will default to a teal color.  To modify the color of
a face, provide a color facet:

    button blue "Blue Button"
    h2 red "Red Heading"
    image %palms.jpg orange

Colors can also be specifed as tuples. Each tuple contains three
numbers: the red, green, and blue components of the color. Each
component can range from 0 to 255. For example:

    button 200.0.200 "Red + Blue = Magenta" 200
    image %palms.jpg 0.200.200 "Green + Blue"

Some face styles also allow more than one color.  The effect of
the color depends on the style.  For text styles the first color
will be used for the text and the second color for the background
of the text:

    txt "Yellow on red background" yellow red
    banner "White on Navy Blue" white navy

For other styles, the body of the face is the first color, and
the second color will be used as its alternate.

    button "Multicolor" olive red
    toggle "Multicolor" blue orange
===Layout Commands


To drop user interface elements on the canvas according to VIDs 
directional layout controls 

---Across

You are placing elements in a row orientation
    
    across 
    return button "A" button "B" button "C"
    return button "D" button "E" button "F"
    

---Below

You are placing elements in a column orientation

    below 
    return button "A" button "B" button "C"
    return button "D" button "E" button "F"

---Mix

You can mix the directional controls 

    across 
    return button "A" button "B" 
    below button "C" 
    across button "D" button "E" button "F"


---Padding


The pad keyword creates extra padding between styles. It uses a pair 
or integer value. When it is an integer, spacing is created either 
horizontally (across) or vertically (below). When it is a pair, the 
spacing will be created both horizontal and vertically. The following 
example illustrates both uses. First, the buttons "one" and "two" 
are padded with an integer representing 40 pixels in one direction. 
Then the buttons "three" and "four" are padded with a pair representing 
40x40 pixels. 

    across 
    button "one" pad 40 button "two" return 
    button "three" pad 40x40 button "four" 


Padding can be negative.
    
        backtile polished orange
        pad 200x200 button "A"
        pad -100x-100 button "B"
        
---Guide

A guide is a virtual alignment control

      title "Buttons Without A Guide" 
    button "one"   button "two"  return 
    button "three" button "four" return 
    button" five" button "six" 

With an implicit guide location

    title "Buttons With An Implicit Guide Location" 
    guide 
    button "one"   button "two"  return 
    button "three" button "four" return 
    button" five" button "six" 

With an explicit guide location

    across title "Buttons With An Explicit Guide Location"
    guide 55x100 
    button "one"   button "two"  return 
    button "three" button "four" return 
    button" five" button "six" 
    
===Tabstops

Tabs can be used for alignment.

---Across

    tabs 200 ; sets tabs every 200 pixels   
    across button 20 "A" tab button 20 "B" tab button 20 "C" 
    tabs 100 ; sets tabs every 100 pixels   
    return button 20 "D" tab button 20 "E" tab button 20 "F"
    
---Below

    tabs 200 ; sets tabs every 200 pixels   
    below button 20 "A" tab button 20 "B" tab button 20 "C" 
    tabs 100 ; sets tabs every 100 pixels   
    return button 20 "D" tab button 20 "E" tab button 20 "F"

---Explicit Settings

Tabstops can be set at explicit values 

    tabs [100 124  166 212 300]

    across tab button 20 "A" tab button 20 "B" tab button 20 "C" tab 
    button 20 "D"
    
===Color Facets

Most styles have a default color.  For example the body of
buttons will default to a teal color.  To modify the color of
a face, provide a color facet:

    button 200 blue "Blue Button"
    h2 red "Red Heading"
    image polished orange

Colors can also be specifed as tuples. Each tuple contains three
numbers: the red, green, and blue components of the color. Each
component can range from 0 to 255. For example:

    button 200.0.200 "Red + Blue = Magenta" 200
    image polished 0.200.200 "Green + Blue"


Some face styles also allow more than one color.  The effect of the 
color depends on the style.  For text styles the first color will 
be used for the text and the second color for the background of the 
text:

    txt "Yellow on red background" yellow red
    title "White on Navy Blue" white navy


For other styles, the body of the face is the first color, and the 
second color will be used as its alternate.

    button 200 "Multicolor" olive red
    toggle 200 "Multicolor" blue orange


From the mailing list, there was a problem reported in changing button 
color:

    view layout [
        b: button "New color" [
            b/color: random 255.255.255 
            show b
        ]
    ]
    

And the answer was that the gradient of the color was preventing 
this change from working:


    style color-changing-button button 0.0.0        ; new style overwrites 
    gradient effect
    b: color-changing-button "New color" [
        b/color: random 255.255.255 
        show b
    ]

===Text Facets


Most faces will accept text to be displayed.  Even graphical faces 
can display text.  For example, the box and image faces will display 
text if it is provided:

    box blue "Box Face"
    image polished "Image Face"


Most button faces will accept more than one text string. The strings 
will be shown as alternates as the face is selected.

    button 200 "Up" "Down"
    toggle 200 "Off" "On"
    rotary 200 "Red" "Green" "Blue" "Yellow"
    choice 200 "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"

    text-list 200 "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"


When other datatypes need to be displayed as text, use the form function 
to convert them first:

    button 250 form now
    field form first read %.
    
===Normal Text Style


Normal text is light on dark and can include a number of facets to 
set the font, style, color, shadow, spacing, tabbing, and other attributes.

    text "Normal"
    text "Bold" bold
    text "Italic" italic
    text "Underline" underline
    text "Bold italic underline" bold italic underline
    text "Big" font-size 32
    text "Serif style text" font-name font-serif
    text "Spaced text" font [space: 5x0]

Text also includes these predefined styles:

    title "Title" 200
    vh1 "vh1"
    vh2 "vh2"
    vh3 "vh3"
    vh4 "vh4"
    label "Label"
    
    
===Document Text Style


Document text is dark on light and can also include a number of facets 
to set the font, style, color, shadow, spacing, tabbing, and other 
attributes.

    txt "Normal"
    txt "Bold" bold
    txt "Italic" italic
    txt "Underline" underline
    txt "Bold italic underline" bold italic underline
    txt "Big" font-size 32
    txt "Serif style text" font-name font-serif
    txt "Spaced text" font [space: 5x0]

Document text also includes these predefined styles:

    title "Centered title" 200
    h1 "Heading 1"
    h2 "Heading 2"
    h3 "Heading 3"
    h4 "Heading 4"
    tt "Typewriter text"
===Text Entry Fields


Text input fields accept text until the enter or tab key is pressed. 
 A text input field can be created with:

    field

To make the field larger or smaller, provide a width:

    field 30
    field 300

Fields will scroll when necessary.


Larger amounts of text can be entered in an area.  Areas also accept 
an enter key and will break lines.

    area

You can also specify the area size:

    area 160x200


To force the text in an area to wrap rather than scroll horizontally, 
provide the wrap option:

    area wrap
===Text Setting


To set the value of a text field under program control, use /text: 
e.g.

    across backtile polished
    return t1: txt      200 "This is some original text"
    return f1: field    200 "Some field text"   
    return a1: area  {Some original area text.} wrap 200x80
    return button 200 "Change Text" [
        t1/text: "Some different text" 
        f1/text: "Some new field text"

        a1/text: {Some wrapping text in the^/ area field to^/ show that this^/ 
        is supported}
        show [t1 f1 a1]
    ]
    
===Text Lists

Text lists are easy to create.  Here is an example.

    text-list "Eureka" "Ukiah" "Mendocino"

You can also provide it as a block:

    text-list data ["Eureka" "Ukiah" "Mendocino"]


Almost any type of block can be provided. Here is a list of all the 
files in your current directory:

    text-list data read %.

Here is a list of all the words REBOL has scanned:

    text-list data first system/words
===Scrolling Text List


A style to allow maintenance of lists from Brett Handley on the REBOL 
list:

        style updatable-text-list text-list
        with [
            update-slider: does [
                sld/redrag lc / max 1 length? head lines
            ]
        ]

        tl: updatable-text-list 300x100 data copy system/locale/months
        button  300x20 "Delete first entry on the list" [
            remove tl/data tl/update-slider show tl
        ]
        button 300x20 "Append the 'now' timestamp to list" [
            append tl/data mold now tl/update-slider show tl
        ]
===Text List Picked Values

    list-of-letters: text-list "a" "b" "c" "d" "e" 
    button 200  "Pick Item 3" [
        clear list-of-letters/picked 

        append list-of-letters/picked pick list-of-letters/data 3 
        show list-of-letters
    ]
===Images

By default an image will be scaled to fit within a face.

    image 60x60 polished
    image polished red

Images can be framed in a number of ways:

    image 100x100 polished frame blue 5x5
    image 100x100 polished bevel
    image 100x100 polished ibevel 6x6

Most other faces can accept an image as well as text:

    box 100x100 polished
    button "Button" polished purple
    toggle "Toggle" polished blue red
    field bold  "This is a field." polished effect [emboss tile]

    field bold "This is another field." polished effect [brighten 100]

The image can be provided as a filename, URL, or image data.



===Backdrops

A backdrop can be a color, an effect, an image, or a combination
of the three.  For example a backdrop color would be written as:

    backdrop navy
    title "Color Backdrop" gold

To create a backdrop effect provide it on the line:

    backdrop effect [gradient 1x1 0.0.100 100.0.0]
    title "Gradient Backdrop" gold

A backdrop image can be a file, URL, or image data:

    backdrop polished
    title "Image Backdrop" red

The backdrop image can be colorized:

    size 400x500 
    backdrop polished blue
    title "Blue Image Backdrop"

The image can include an effect:

    backdrop polished effect [fit gradcol 1x1 100.0.0 0.0.250]
    title "Gradient Image Backdrop"
    
===Backtile

To make a backdrop use a tile effect there are two options:

    backdrop polished effect [tile]
    banner "This shows a backdrop with a tile effect"
    
or

    backtile polished
    banner "This demonstrates backtile"


Note the difference between:

    size 400x500 
    backdrop polished
    banner "Here one image is stretched to cover the canvas"

and

    size 400x500 
    backtile polished
    banner "Here one image is repeated to cover the canvas"
    
===Effect Facets


A range of effects are supported for faces.  All of these effects 
are performed directly on the face when it is rendered. Here are 
examples of a few possible effects in top to bottom then left to 
right order:

    style polished-steel image 80x60 polished 
    polished-steel effect [flip 1x1]
    polished-steel effect [rotate 90]
    polished-steel effect [reflect 1x1]
    polished-steel effect [crop 0x50 120x60 fit]
    polished-steel effect [grayscale]
    polished-steel effect [invert]
    polished-steel effect [difference 200.0.0]
    polished-steel effect [tint 80]
    return
    polished-steel effect [contrast 50]
    polished-steel effect [brighten 50]
    polished-steel effect [sharpen]
    polished-steel effect [blur]
    polished-steel effect [colorize 204.0.0]
    polished-steel effect [gradcol 1x1 150.0.0 0.0.150]
    polished-steel effect [gradmul 0x1 0.100.0]
    polished-steel effect [grayscale emboss]


Effects can be used in combination to create other interesting results. 
 However, keep in mind that the computations are performed in real 
time.  If complex combinations are required, a temporary image should 
be created with the to-image function.


===Actions


An action can be associated with almost any face. To do so, follow 
the face style with a block:

    button "Test" [alert "test"]


The block is used as the body of a function that is passed the face 
and the current value (if the face has one).  For example:

    toggle "Toggle" [alert form value] 
    rotary "A" "B" "C" [alert form value]
    text "Click Here" [alert  face/text]

If a second block is provide, it is used for the alternate
actions (right key):


    button "Click Here" [view/new layout [txt "action"]] [view/new layout 
    [txt "alt-action"]]


Use variables to modify the contents or state of other faces. For 
example, the slider will update the progress bar:

    slider 200x16 [p1/data: value show p1]
    p1: progress

!More action on actions needed...

===Show


After the state is changed for a user interface element, it must 
be re-drawn to be reflected on the user interface canvas.

Accomplish this with the show message.

    backtile polished
    across 
    toggle "Toggle State"  
            [   cybernetics?/data: not cybernetics?/data
                show cybernetics?]  

    return  label "Are you interested in cybernetics?" cybernetics?: 
    check 

One show command can be used for multiple user interface elements

        backtile polished orange
        across
        b1: check label "Red" return
        b2: check label "Green" return

        button 200 "Change State But No Refresh" [b1/data: not b1/data b2/data: 
        not b2/data] return
        button "Show" [show [b1 b2]]
===Hide

A user interface element can also be hidden.

        backtile polished orange
        across
        c1: check 
        hide-button: button "Hide" [hide c1] return
        show-button: button "Show" [show [c1 d2]]


The show-button action tries to show a user interface element 'd2' 
that does not exist.
REBOL/View ignores these.
===Invisible Faces


To make a button invisible when the view is opened, you can define 
an invisible button style

This approach sets the show? value to false when the user interface 
element is initialized.

    across

    style invisible-button button with [append init [show?: false]]
    late-shower: invisible-button "I'm Here" return
    return button 200 "Show Invisible Button" [show late-shower]
    
This works for the other visible user interface element.

===Focus

A user interface element can programmatically be given the focus.

    across backtile polished 
    button 200 "Set focus to Phone Field" [focus f2] 
    return label "Name: "   f1: field 100 
    return label "Phone: " f2: field 100 

    return button 200 "Remove focus from Phone Field" [unfocus f2] 
    return button 200 "Hide the Phone Field" [hide f2] return

---Focus Defect


!Note that the tab function shows a hidden field. I have assumed 
that this is a defect. If a field is hidden, the tab button should 
not make it visible. This has been previously sent to feedback.

===Radio Buttons


A radio button is used to make a choice between mutually exclusive 
values. Your preferred programming language is REBOL or C++ or PL/1 
or APL but it is only one of those.

            across backtile polished

            radio of 'programming-language pad 0x-4 label "REBOL" return

            radio of 'programming-language pad 0x-4 label "C++" return

            radio of 'programming-language pad 0x-4 label "PL/1" return

            radio of 'programming-language pad 0x-4 label "APL" return


To mix two groups of radio buttons on one screen, associate them 
with their groups using the "of 'word". In the above, the grouping 
is 'programming-language.

            across backtile polished

            radio of 'programming-language pad 0x-4 label "Language: REBOL" return

            radio of 'programming-language pad 0x-4 label "Language: C++" return

            radio of 'editor pad 0x-4 label "Editor: TextPad" return

            radio of 'editor pad 0x-4 label "Editor: Notepad" return


The padding in the above is needed to keep the label aligned with 
the radio button.

            across backtile polished orange

            radio of 'programming-language pad 0x-4 label "REBOL" return

            radio of 'programming-language          label "APL" return
            
            
            
            

===Radio Button Settings


A radio button is not very useful unless you can find out what its 
setting is and change that setting under program control.


            across backtile polished orange

            rebol-radio:    radio of 'programming-language  [programming-language: 
            'rebol] pad 0x-4 label "REBOL" return

            apl-radio:      radio of 'programming-language  [programming-language: 
            'apl]         label "APL" return
            button 200 "Toggle radio button" [

                    apl-radio/data: not rebol-radio/data: not rebol-radio/data
                    show [rebol-radio apl-radio]
            ]
            
===Check Box

---Purpose


A check box is used to allow user interface choices where the choices 
are not mutually exclusive.

        across backtile polished orange
        c1: check label "Likes animals" return
        c2: check label "Like Monkees" return
        c3: check label "Like The Animals"
        
---State


A check box is not much good if you can't get and set its state (on 
or off).

        across backtile polished orange
        c1: check label "Likes animals" return
        c2: check label "Like Monkees" return
        
    button "Set State" [
        c1/data: true 
        show c1
        c2/data: false
        show c2
    ]
 
 
===Sensor

---Purpose


A sensor is an invisible user interface element. Using a sensor only 
makes sense in a few instances. 


If you want a keycode action where there is no visible user interface 
element to link the action to then a sensor can be used.


This sensor code adds an Escape or Back or Enter action that will 
close the window. 

    sensor 1x1 keycode [#"^M" #" " #"^(back)" #"^(ESC)"] [unview]


Or if you want to make portions of an image 'hot' instead of putting 
buttons on top of the image, then a sensor will achieve this.

        across backtile polished orange

        txt "Click on the upper left section of the gray image to invoke 
        the sensor action"

        return animage: image 100x100 polished      ; here the image is just 
        the polished area

        at animage/offset sensor 50x50 [alert "You pushed over the sensor"]
        
===Displaying Script Values


If the script has a standard format headings, including custom ones, 
these can be used in the application by picking them from the system/script/header.

        backtile polished
        across banner "About"

        return text font-size 16    rejoin ["Title: "           form system/script/header/title]

        return text font-size 16  rejoin ["Originator: "    form system/script/header/author] 
              

        return text font-size 16  rejoin ["Modifier: "      form system/script/header/modifier]

        return text font-size 16  rejoin ["Version: "       form system/script/header/version]

        return text font-size 16  rejoin ["Updated: "       form system/script/header/date]
        return button "OK" [unview] 

===Toggle


A toggle button represents boolean state - either on or off. The 
button stays down until toggled again.
Colors and text can be paired for "on" and "off" state.

    toggle "Up" "Down" red blue

To set the state via program control, use:

        across backtile polished
        return t1: toggle "Up" "Down" red blue
        return button polished 204.0.0 100 "Toggle State" [
            t1/state: not t1/state
            show t1
        ]


===Rotary Buttons


Rotary buttons are a different sort of user interface device. They 
can cause some challenges because the state is what's showing so 
you have to blindly "toggle" to get to a state that you want.  But 
for quick and easy uses where the user is familiar with the options, 
they can be handy.  If you plan to use them for a long list of items 
such as shown  below, they might give you some usability concerns.


---Example

        across backtile polished
        rotary data ["First" "Second" "Third"]

---Setting State

        across backtile polished

        return r1: rotary data (my-options: ["First" "Second" "Third"])
        return button 200 "Change Rotary State" [
            r1/data: next r1/data
            if tail? r1/data [r1/data: head r1/data]
            show r1
        ]

---Example - Usability For Unfamiliar List Contents


The rotary button demonstrated here contains some information unfamiliar 
to most (Saturn's satellites). Use it to to set the state so that 
"Calypso" is set. Doable but without knowing the order each re-paint 
has to be checked to ensure that it is not "Calypso" before clicking 
again.  If you do click past the choice that you want, there is no 
back function so you have to cycle through again.

        return rotary data [

            "Pan" "Atlas" "Prometheus" "Pandora" "Epimetheus" "Janus" "Mimas" 
            "Enceladus" "Tethys" "Telesto" "Calypso" "Dione" "Helene" "Rhea" 
            "Titan" "Hyperion" "Iapetus" "Phoebe"        
        ]


===Arrows


REBOL/View supports arrows as simple user interface elements. Actions 
can be associated with them.



---Arrowheads And Actions

By default, the arrow is 20x20

    across size 200x100 
    backtile polished
    at 50x50 arrow left 
        [alert "You pressed the left arrow"] 

        [alert "You pushed the alternate button on the left arrow"] 
    at 70x30 arrow up
    at 90x50 arrow right [alert "You pressed the right arrow"]
    at 70x70 arrow down
    
---Very Sharp Arrows


And with a little work the arrows and boxes can be merged to look 
sharper. Here is a "sharp at both ends" arrow from the block diagram 
script by Carl:

    origin 0
    backcolor white
    at 0x0 box 40x40 white effect [arrow rotate 270]
    at 110x0 box 40x40 white effect [arrow rotate 90]
    at 24x10 box black 100x20
    
---Arrow Blend

So that shows you how to make an arrow blend into your background

    size 100x100
    across backdrop gray
    at 50x50 box 40x40 gray effect [arrow rotate 90]
    at 40x67 box 25x5 black
    
===LED

LEDs would be used to display state (on or off).  

Clicking the LED toggles its state and changes its color.

LEDs do not support alternate mouse button actions.

    across banner "Light Emitting Diode"
    return 

    l1: led 10x10 [alert "LED left mouse action"] label "Alert status"

    l2: led 10x10 [alert "LED left mouse action"] label "Network status"
    return button "Change state" [
        l1/data: not l1/data
        l2/data: not l2/data 
        show [l1 l2]        
    ]
    
===Box


---Boxing

Draw boxes of any heigth and width with the box style

    box "Large Box" 200x400 polished orange
    
---Boxes As Lines


If you make the box narrow enough or short enough it is a line (or 
a dot).

    across size 300x300 backtile polished
    at 50x0 box 3x100 gold
    at 0x50 b1: box 100x3 gold
    at 10x10 box 5x5 red
    
---Boxes Can Grow

    across size 300x300 backtile polished
    at 150x0 b1: box 100x3 gold
    return pad 0x100 button "Grow Down" [
        for i 3 300 1 [
            b1/size/y: 1 + b1/size/y
            wait 00:00:00.01
            show b1
        ]
    ]

    return pad 0x100 button "Back Up" [
        for i 300 3 -1 [
            b1/size/y: b1/size/y - 1
            wait 00:00:00.01
            show b1
        ]
    ]

You might even find a use for it.


---Grid Effect

Not sure of the use for this yet but here is what you can do:


 return box "Grid Lock" with [effect: [grid 20x20 8x8 4x3]] white 
 300x200
 

 return box "Grid Lock" with [effect: [grid 20x20 5x5 3x3]] white 
 - 80 300x200
 
===Frame

Earlier versions of REBOL VID supported frames in layouts such as
view layout [frame "This is the Bay" %bay.jpg]

These are no longer valid.

But frames can be put around some user interface devices:

    image 100x100 polished frame red
    
===List


A list is an iterated sub layout and takes a layout block that uses 
the Visual Interface Dialect. The styles in the layout will be repeated 
until there is no more room to fit them within the list dimensions.


---Why


A face can be iterated to create a number of virtual faces. For instance, 
when displaying a list of ten buttons, each of the buttons does not 
need to be created as a separate object. If the buttons only differ 
by a few facets (such as position, text, and action taken on selection), 
a model face can be created and iterated for its other position. 
This is useful when creating scrolling lists of files and other data 
sets that share the same appearance. 

---Supply


Supply provides the data to the list for an iterated face.

    do [cnt: 0
        list-collection: [aqua sky water]    
    ]
    backtile polished orange
    across
    list-displayed: list 100x72 [
        origin 0 space 0x0 across
        color-field: txt bold 80x24
    ] supply [
            if none? one-color: pick list-collection count [exit]
            face/text: do pick [one-color] index

    ]

    return txt gold 180 "OK ... but not too useful"


---Supply Columns

Maybe adding some more columns would be better.

Here I'll add a column of buttons that display the color name
and a column of text strings in italic.

    do [
        cnt: 0
        list-collection: [aqua sky water gold silver coffee]    
    ]
    backtile polished orange
        across
        list-displayed: list 300x200 [
            origin 0 space 0x0 across
            color-field: txt bold 80x24
            color-button: button 80x24
            pad 5x1
            txt 100 italic
        ] supply [

                if none? one-color: pick list-collection count [exit]
                face/text: do pick [
                    [one-color]
                    [to-string one-color]
                    [rejoin ["  " to-string one-color]]
                    ] index 
    ]
    

    return txt gold 300 {A bit more interesting but the last row repeats 
    to fill the list size. Some of the other VID components will automatically 
    stretch to fit the size needed (such as this txt field) but the list 
    does not behave that way.  You have to make the list size fit its 
    data or make it smaller and add a vertical scroll capability. That 
    is shown a little later on.}

===List With Supplied Data

This example is to show adding action to the list
and adds a horizontal line between the rows.


    do [
        cnt: 0
        list-collection: [aqua sky water gold silver coffee]    
    ]
    backtile polished orange
        across

        list-displayed: list water edge [size: 6x6 color: silver]  350x96 
        [  
            origin 0 space 0x0 across

            color-field: txt 60 [alert rejoin ["You pressed the " face/text " 
            text field"]]
            pad 45x0            

            color-button: button 80 [alert rejoin ["You pressed the " face/text 
            " button"]]
            pad 5x0
            txt 120 italic

            return box 350x1 white      ; this causes a horizontal line to appear 
            between each row

        ] supply [

                if none? one-color: pick list-collection count [exit]
                face/text: do pick [
                    [one-color]
                    [to-string one-color]
                    [rejoin ["  " to-string one-color]]
                    ] index 
    ]


===Supply List With Scroll

This example shows a supplied list with a scroll capability.
More colors are added to demonstrate scrolling.

Note that this is a verbose list of code where I added comments
for my understanding of how the scroll was linked to the list.
The same effect can be accomplished with fewer lines of code.
    

    do [    ; first this do block creates the data definitions needed.
        slider-position-clicked:  0
        count: 0    
        x: 450
        y: 300

        row-y: 16           ; the row height includes the data plus any separator 
        lines 

        list-size: to-pair reduce [x y]     ; this is the size of the display 
        list  
        separator-size: to-pair reduce [x 1]
        slider-size: to-pair reduce [24 y ]
        list-collection: [

            aqua           bar-color   base-color     beige         black    
                  blue           brick          brown      

        button-color   coal        coffee         crimson       cyan     
              forest         gold           gray       

        green          ivory       khaki          leaf          linen    
              magenta        main-color     maroon     

        mint           navy        oldrab         olive         orange   
              over-color     papaya         pewter         

            pink           purple      rebolor        red           sienna   
                  silver         sky            snow

        tan            teal        violet         water         wheat    
              white          yellow        
        ]    
        
        supply-style: stylize [

                button-fixed: button left coal to-pair reduce [80 row-y]        ; 
                these keep the row elements the same height

                text-fixed: txt to-pair reduce [160 row-y]          
        ]
        
        data-size: length? list-collection  
    ]
    

    backtile polished orange                        ; this section layouts 
    out the list
        
        across

        list-position: at                                   ; the position 
        is captured here in order to later put the slider beside it
        list-displayed: list linen 
            edge [size: 6x6 color: tan]  list-size [  
            origin 0 space 0x0 across
            styles supply-style

            text-fixed [alert rejoin ["You pressed the " face/text " text field"]]

            button-fixed [alert rejoin ["You pressed the " face/text " button"]]
            pad 5x0 

            text-fixed 80 italic [alert rejoin ["You pressed the italic " face/text 
            " text field"]]

            return box separator-size gray      ; this causes a horizontal line 
            to appear between each row

        ] supply [
                count: count + slider-position-clicked  

                if none? one-color: pick list-collection count [exit]
        face/text: 
            either count > (1 + data-size) 
            [""]
            [
                             do pick [

                                    [one-color]                                                      
                                           ; this is supplied to the first txt field (text-fixed)

                                    [to-string one-color]                                           ; 
                                    this is supplied to the button (button-fixed)

                                    [rejoin ["  " to-string one-color " "]]     ; this value is supplied 
                                    to the last text-fixed field
                            ] index 
                    ]
        ]


        ; now add a slider to the side of the list



        at list-position + (list-size * 1x0)                             
           ; this finds the top right border of the list widget
        vertical-slider: slider slider-size to-integer y / row-y
        [

                    slider-position-clicked: vertical-slider/data   ; the slider has 
                    to be bound to the size of the list                

                        * ((1 + data-size) - ((y / (1 + row-y))))       ; including the row 
                        height
                    if slider-position-clicked <> count [
                        count: slider-position-clicked 
                        show list-displayed
                    ]
                ]


===Slider


A slider is interactive user interface element. The data of a slider 
varies from 0 to 1.

    backtile polished   orange across
    slider-1: slider 200x40 
    return button 200 "Move first slider to 50%" [
        slider-1/data: .5 
        show slider-1
    ]

    return txt 200 "The second slider in this example is initialized 
    to the 80% mark."  
    return slider 200x40 with [append init [data: .8]]
    
===Progress Indicator


The progress-1 face in this example is a progress indicator. Because 
it is only displaying information, it is non-interactive i.e. you 
can not change its value by dragging its edges.  The alternate button 
is not supported on a progress indicator.

    backtile polished   orange across
    slider 200x40 [
        progress-1/data: value 
        field-1/text: join (to-integer (100 * value)) " %"
        show [progress-1 field-1]
    ] 
    return progress-1: progress
    return field-1: field
===Panels 


Panels are used to create sub-panes that can be more easily managed 
by grouping

the user interface devices on a panel. The first example below shows 
how to use panels for layout alignment. By creating a panel definition, 
all of the components defined within it are aligned relative to its 
origin.

    across backtile polished brick
    tabs 50
    return panel-1: panel 250x120 [
        backtile polished
        across
        return button water 200 "Button A"
        return button aqua  200 "Button B"
        return button sky   200 "Button C" 
    ]


    at panel-1/offset + panel-1/size panel 60x90 [  ; start at the bottom 
    right corner of panel-1
        backtile polished
        across
        return button tan       20 "1"
        return button coffee    20 "2"
    ]
    
---Multiple SubPanels example


This example from the REBOL html documentation shows how to easily 
hide and show sections of a user interface by displaying them on 
the face area of a box.  


        do [                                ; define two panels
            panel1: layout [
                    origin 8x8
                    h2 "Panel 1"
                    field "Field 1"
                    field "Field 2"
                    button "The Answer" [alert "I know nothing."]
            ]


            panel2: layout [
                origin 8x8
                    h2 "Panel 2"
                    across
                    txt "X:"
                    slider 150x16
                    return
                    txt "Y:"
                    slider 150x16
                    return
                    check [panel2/color: maroon  show panel2]
                    txt "Don't click this"
                    return 
                    check [panel2/color: silver  show panel2]
                    txt "Click this" 
                    return
                ]

                panel1/offset: 0x0
                panel2/offset: 0x0
        ]


        vh2 "Subpanel Examples"     ; now demonstrate panel use
        guide
        pad 20
        button "Panel 1" [panels/pane: panel1  show panels]
        button "Panel 2" [panels/pane: panel2  show panels]
        button "Quit" [unview]
        return
        box 2x140 maroon
        return
        panels: box 220x140
        do [panels/pane: panel1]
        
===Simple Default Style Override


The style's default look can be overriden easily with one line of 
code. 


For example, to make the default button size 200x200 with a water 
color, use

    style button button 200x200 water
    button "Big Blue Button" [unview]

To make the toggle some different default colors:

    style toggle toggle crimson sky
    toggle "Up" "Down"


Note that these stay in effect until they are overridden so if you 
use the default values, exercise some care unless you meant to do 
that. 



===Image Maker


An option used by Carl in some of his programs is to let View create 
specific icons so that you have portability and more control of look 
of the image then if you referenced an external file such as gif 
that was a bullet display. Here's how to do that:

    do [    
        make-image: func [xy wh eff] [
            eff: layout [
                size 20x20 at xy
                box wh effect eff
            ]
        eff/color: rebolor
        to-image eff
        ]


        dot: make-image 6x5 9x9 [gradient 1x1 255.0.0 0.0.0 oval key 0.0.0]

        dot-big: make-image 8x7 12x12 [gradient 1x1 255.0.0 0.0.0 oval key 
        0.0.0]
        arr: make-image 3x3 14x14 [arrow 0.0.127 rotate 90]
        ard: make-image 3x3 14x14 [arrow 0.0.127 rotate 180]    

    ]   ; end of "do" - it is needed here because easyvid approach is 
    expecting vid dialect commands

    banner "Presentation Points"
    size 400x300 across

    style label label gold     ; make a label's text be a different color 
    than the default
    return image dot label "This is bullet point number 1" 
    return image dot label "This is bullet point number 2"
    return image arr label "This is arrow point number 1"

    return image ard label "This is an arrow making a different point"

    return image dot-big pad 0x4 area 300x80 wrap "And because these 
    arrows and dots are images, action can be added to them to make them 
    'hot' with mouse actions including 'over'."
    
===Needs Some Work

!More to come.  These still need to be covered in this
tutorial:

    text-list data [
        icon
    ]
    
===Digital Clock

    origin 0
    banner "00:00:00" rate 1 effect [gradient 0x1 0.0.150 0.0.50]

        feel [engage: func [face act evt] [face/text: now/time  show face]]


 


===REBOL Logo

 image %rebo-logo.gif [unview]

===Paint Drops

REBOL one liner by Vincent Ecuyer


 b: box rate 9 effect[draw[pen(random snow)circle(random 99x99)2]blur]box 
 1x1 rate 9 effect[draw[(b/image: to-image b)]]
 
===eMailer

One line emailer by Doc Kimbel

Assumes you have set up your email in set-user



 e: field "Email" s: field "Subject" m: area "Body" btn "Send"[send/subject 
 to-email e/text m/text s/text alert "ok"]
 
===Hello World

 text "Hello World!" button "Close" [unview]
===Three Buttons

 button "Yes" button "Maybe" button "No"

===View Web Text

 text 800x600 read http://www.rebol.com
 
===View Image

 image %palms.jpg
 
===View Image and File Name


Here a do block is used to initialize the file variable within the 
layout code.

 do [file: %palms.jpg]
 image file  text form file
 
 
===View Image behind File Name


Here a do block is used to initialize the file variable within the 
layout code.

 do [file: %palms.jpg]

 image file form file
 
 
===Buttons From Images

    backdrop 40.70.140
    stat: text bold "Click a Button" 100x20 240.140.40 center
    button "Bay Test"  %bay.jpg 100x100 [
        stat/text: "Upper" 
        show stat
    ]
    button "Blue Test" %bay.jpg 100x100 10.30.180 [
        stat/text: "Lower" 
        show stat
    ]
===View List


 list blue 320x200 [across text white 200 text white 100] data [
    ["John" 100] 
    ["Joe" 200] 
    ["Martin" 300]
 ]
===Movie Credits



    backdrop %bay.jpg effect [fit]

    text center bold 240x30 "REBOL, The Movie" yellow font [size: 16]
    credits: text {

 Edit This File 

 To Add Your Own Credits 
 

 It is very simple to do. 

 Only takes a minute. 

 Only REBOL Makes It Possible...

 } white bold center 240x180 rate 30 para [origin: 0x+100]
        feel [engage: func [f a e] [

            if a = 'time [f/para/origin: f/para/origin - 0x1 show f]
        ]
    ]



===Fire Demo

    box 150x150 with [
        edge: none
        img: image: make image! 150x150
        rate: 20
        text: "FIREBOLEK"
        font: make font [size: 24 color: 255.125.0]

        basic: [draw [image make pair! reduce [(random 3)  - 2 -1] img]]
        effects: reduce [
            append copy basic [blur luma -10]
            append copy basic [sharpen luma -10 blur]
            append copy basic [contrast 10 blur luma -5]        
        ]
        effect: first effects
        feel: make feel [
            engage: func [f a e][
                switch a [

                    down [f/effects: next f/effects if tail? f/effects [f/effects: head 
                    f/effects] f/effect: first f/effects show f]

                    time [show f repeat i f/size/x - 4 [poke f/image (f/size/x * f/size/y) 
                    - i - 2 (random 255.0.0 + random 0.127.0) * 3] f/img: to-image f] 
                           
                ]       
            ]
        ]
    ]
    text 150 {classical fire demo for REBOL^/
 press on fire to see other effects.^/   
 Written by ReBolek, 2001 in 15 mins.^/
 We need new category on Assembly:^/
 less-than-kb-demo ;-)} with [font: make font  [size: 9]]
===Bezier 

Oldes Bezier Line Demo

See script library for %bezier-curve.r

Uses functions and data initialized at script startup

The end points are draggable to change the curve!!!!


Here a do block is used to allow executable lines for initialization 
purposes.

 do [

    draw-beziere-curve: has [result pp x0 x1 x2 x3 y0 y1 y2 y3 cx bx 
    ax cy by ay t tx ty s] [
    result: make block! 120
    pp: p0/size/x / 2
    x0: p0/offset/x + pp
    y0: p0/offset/y + pp
    x1: p1/offset/x + pp
    y1: p1/offset/y + pp
    x2: p2/offset/x + pp
    y2: p2/offset/y + pp 
    x3: p3/offset/x + pp
    y3: p3/offset/y + pp

    insert result compose [
        pen 155.0.0
        line (p0/offset + pp) (p1/offset + pp)
        line (p2/offset + pp) (p3/offset + pp)
        pen 255.255.255 line (p0/offset + pp)
    ]    
    cx: 3 * (x1 - x0)
    bx: 3 * (x2 - x1) - cx
    ax: x3 - x0 - cx - bx
    cy: 3 * (y1 - y0)
    by: 3 * (y2 - y1) - cy
    ay: y3 - y0 - cy - by
    
    t: s: 0.01 ;this value sets quality of the curve
    
    while [t <= 1][
        tx: to integer! (

                (ax * (t * t * t)) + (bx * (t * t)) + (cx * t) + .5
            ) + x0
        ty: to integer! (

                (ay * (t * t * t)) + (by * (t * t)) + (cy * t) + .5
            ) + y0

        t: t + s
        insert tail result to pair! reduce [tx ty]
    ]
    return result
 ]


 click?: false
 mouse-pos: 0x0


 ]

    origin 0

    bkg: box black 400x400 with [effect: reduce ['draw make block! 120]]
    style point box 10x10 with [

        effect: [draw [pen 0.255.0 fill-pen 0.200.0 circle 4x4 4]]
        changes: [offset]
        feel: make feel [
            engage: func [f a e][
                if a = 'down [click?: on mouse-pos: e/offset]
                if a = 'up   [click?: off]
                if find [over away] a [
                    if click? [
                        f/offset: f/offset + e/offset - mouse-pos
                        bkg/effect/2: draw-beziere-curve
                        show [bkg f]
                    ]
                ]
            ]
        ]
    ]
    at 300x200 p0: point
    at 200x100 p1: point
    at 200x300 p2: point
    at 100x200 p3: point
    do [bkg/effect/2: draw-beziere-curve]
                   
===Buttons Galore

Buttons galore from the library script %buttons.r


Here a do block is used to execute the initialization needed within 
the layout block.



    do [
        group: ["rotary" "test" "button"]
    ]

    origin 20x10
    backdrop effect [gradient 0x1 100.20.0]

    vh1 "52 Button Click-up - Each with a different click effect..."

    vtext bold "Here is a small sampling of the thousands of button effects 
    you can create. (This is 78 lines of code.)"
    at 20x80 guide
    button "simple"
    button form now/date
    button "colored" 100.0.0
    button "text colored" font [colors: [255.80.80 80.200.80]]
    button with [texts: ["up text" "down text"]]
    button "bi-colored" colors [0.150.100 150.20.20]

    button with [texts: ["up color" "down color"] colors: [0.150.100 
    150.20.20]]
    button "image" pic
    button "color image" pic 200.100.50

    button "flip color" pic with [effects: [[fit colorize 50.50.200][fit 
    colorize 200.50.50]]]
    button "blink" with [rate: 2 colors: [160.40.40 40.160.40]]
    return

    button "multiply" pic with [effects: [[fit][fit multiply 128.80.60]]]
    button "brighten" pic with [effects: [[fit][fit luma 80]]]

    button "contrast" pic with [effects: [[fit][fit contrast 80]]]
    button "horiz flip" pic with [effects: [[fit][fit flip 1x0]]]

    button "vert reflect" pic with [effects: [[fit][fit reflect 0x1]]]
    button "invert" pic with [effects: [[fit][fit invert]]]

    button "vert grad" with [effects: [[gradient 0x1 0.0.0 0.200.0] [gradient 
    0x1 0.200.0 0.0.0]]]

    button "horiz grad" with [effects: [[gradient 1x0 200.0.0 200.200.200][gradient 
    1x0 200.200.200 200.0.0]]]

    button "both grad" with [effects: [[gradient 1x0 140.0.0 40.40.200] 
    [gradient 0x1 40.40.200 140.0.0]]]

    button "blink grad" with [rate: 4 effects: [[gradient 1x0 0.0.0 0.0.200] 
    [gradient 1x0 0.0.200 0.0.0]]]

    button "blink flip" pic with [rate: 8 effects: [[fit][fit flip 0x1]]]
    return
    button "big dull button with several lines" 100x80 0.0.100

    button "dual color" pic 50.50.100 100.50.50 100x80 with [edge: [color: 
    80.80.80]]

    button "big edge" pic 100x80 with [edge: [size: 5x5 color: 80.80.80] 
    effects: [[fit colorize 50.100.50][fit]]]

    button "oval reflect" pic 50.100.50 100x80 with [effect: [fit reflect 
    1x0 oval]]
    return

    button "text on top" pic 100x80 with [font: [valign: 'top] effects: 
    [[fit gradcol 1x1 200.0.0 0.0.200] [fit gradcol -1x-1 200.0.0 0.0.200]]]

    button "text on bottom" pic 100x80 50.50.100 with [font: [valign: 
    'bottom] effects: [[fit][fit invert]]]

    button "big text font" pic 100x80 with [font: [size: 24] effects: 
    [[fit multiply 50.100.200][fit]]]

    button "cross flip" pic 50.100.50 100x80 with [effect: [fit flip 
    0x1 reflect 0x1 cross]]
    return
    toggle "toggle"
    toggle "toggle red" 100.0.0 
    toggle "toggle up" "toggle down"
    toggle "toggle colored" 0.150.100 150.20.20
    toggle "up color" "down color" 0.150.100 150.20.20

    toggle "toggle multiply" pic with [effects: [[fit][fit multiply 128.80.60]]]

    toggle "toggle contrast" pic with [effects: [[fit][fit contrast 80]]]
    toggle "toggle cross" pic with [effects: [[fit][fit cross]]]

    toggle "toggle v-grad" with [effects: [[gradient 0x1 0.0.0 0.200.0] 
    [gradient 0x1 0.200.0 0.0.0]]]

    toggle "toggle h-grad" with [effects: [[gradient 1x0 200.0.0 200.200.200][gradient 
    1x0 200.200.200 200.0.0]]]

    toggle "toggle both" with [effects: [[gradient 1x0 140.0.0 40.40.200] 
    [gradient 0x1 40.40.200 140.0.0]]]
    return
    rotary data group
    rotary data reduce [now/date now/time]
    rotary data group 100.0.0 0.100.0 0.0.100

    rotary data group with [font: [colors: [255.80.80 80.200.80]]]
    rotary data group with [colors: [0.150.100 150.20.20]]
    rotary data group pic
    rotary data group pic 200.100.50

    rotary data group pic with [effects: [[fit colorize 50.50.200][fit 
    colorize 200.50.50]]]

    rotary data group with [effects: [[gradient 0x1 0.0.0 0.200.0] [gradient 
    0x1 0.200.0 0.0.0]]]

    rotary data group with [effects: [[gradient 1x0 200.0.0 200.200.200][gradient 
    1x0 200.200.200 200.0.0]]]

    rotary data group with [effects: [[gradient 1x0 140.0.0 40.40.200] 
    [gradient 0x1 40.40.200 140.0.0]]]
===Paint Program


This section is a clip of the layout portion of Frank Sievertsen's 
remarkable paint program. Open this example to enable a quick link 
to the real source:


 button "Browse Source" [browse http://www.reboltech.com/library/html/paint.html]
 button "Close" [unview]


In the example below, a DO block is used to execute initialize code.

 do [

    color: fill-color: start: draw-image: draw-pos: tmp: none
    type: 'box
    undos: [] redos: []
    draw: func [offset /local tmp] [
        compose [
            pen (color/color) fill-pen (fill-color/color)
            (type) (start) (either type = 'circle [
                tmp: offset - start
                to-integer square-root add tmp/x ** 2 tmp/y ** 2
            ] [offset])
        ]
    ]
 ]
 
        backdrop effect compose [gradient 1x1 (sky) (water)]
        across
        draw-image: image white 300x300 effect [draw []]
        feel [engage: func [face action event] [
            if all [type start] [
                if find [over away] action [
                    append clear draw-pos draw event/offset
                    show face
                ]
                if action = 'up [
                    append/only undos draw-pos
                    draw-pos: tail draw-pos
                    start: none
                ]
            ]
            if all [type action = 'down] [
                start: event/offset
            ]
        ]]
        do [draw-pos: draw-image/effect/draw]
        guide
        style text text [
            tmp: first back find face/parent-face/pane face
            tmp/feel/engage tmp 'down none
            tmp/feel/engage tmp 'up none
        ]
        label "Tool:" return
        radio [type: 'line] text "Line"
        return
        radio [type: 'box] on text "Box"
        return
        radio [type: 'circle] text "Circle"
        return
        style color-box box 15x15 [

            face/color: either face/color [request-color/color face/color] [request-color]
        ] ibevel
        color: color-box 0.0.0 text "Pen"
        return
        fill-color: color-box text "Fill-pen"
        return
        button "Undo" [if not empty? undos [
            append/only redos copy last undos
            draw-pos: clear last undos
            remove back tail undos
            show draw-image
        ]]
        return
        button "Redo" [if not empty? redos [
            append/only undos draw-pos
            draw-pos: insert draw-pos last redos
            remove back tail redos
            show draw-image
        ]]
===Font Lab

Carl's Font lab



Here a do block is used to initialize some values needed in the layout

 do [

    change-styles: func [style start facet subfacet value /local v][
    start: find style/pane start
    foreach f start [
        f: in f facet
        if subfacet <> 'none [f: in get f subfacet]
        either block? value [

            if not block? get f [set f either none? get f [copy []][reduce [get 
            f]]]

            either v: find get f value [remove v][head insert get f value]
        ][set f value]
    ]
    show style
 ]

 chg: func ['facet 'subfacet value] [
    change-styles external-view norm-start facet subfacet value
 ]
 shad: does [chg font shadow sdir * to-integer sl2/data * 16]
 sdir: 1x1
 sz: 180x40
 sx2: sz/x / 2 
 ]



    style tgl toggle 60
    style lab vtext bold
    backcolor rebolor
    space 0x5
    across 

    p: choice 180 "Sans-Serif Style" "Serif Style" "Fixed Width Style" 

        [chg font name pick reduce [font-sans-serif font-serif font-fixed] 
        index? p/data]
        return
    tgl "Bold" [chg font style [bold]]
    tgl "Italic" italic [chg font style [italic]]
    tgl "Lined" underline [chg font style [underline]]
    return
    tgl "Left" of 'tg1 [chg font align 'left]
    tgl "Center" of 'tg1 [chg font align 'center]
    tgl "Right" of 'tg1 [chg font align 'right]
    return
    tgl "Top" of 'tg2 [chg font valign 'top]
    tgl "Middle" of 'tg2 [chg font valign 'middle]
    tgl "Bottom" of 'tg2 [chg font valign 'bottom]
    return
    lab "Size:" 60x20 font []

    sl: slider 120x20 [chg font size max 8 to-integer sl/data * 40] 
     with [append init [data: .5]]
    
    return
    lab "Space:" 60x20 font []

    sl1: slider 120x20 [chg font space (1x0 * to-integer sl1/data * 20) 
    - 5x0]
    return
    lab "Shadow:" 60x20 font []
    sl2: slider 120x20 [shad]  with [append init [data: .5]]
    return
    lab "Shad Dir:" 60x20
    arrow left  [sdir: sdir * 0x1 + -1x0 shad] pad 6
    arrow right [sdir: sdir * 0x1 + 1x0 shad]  pad 6
    arrow up    [sdir: sdir * 1x0 + 0x-1 shad] pad 6
    arrow down  [sdir: sdir * 1x0 + 0x1 shad]  pad 6
    return
    button sx2 "Text Color" [chg font color request-color]
    button sx2 "Area Color" [chg color none request-color]
    return

    button sx2 "Help" [alert "Click the controls on the left to change 
    text on the right."]
    button sx2 "Close" #"^Q" [unview]
    below
    at p/offset + (p/size * 1x0) + 10x0
    norm-start:
    Title "Title" sz
    h1 "Heading 1" sz
    h2 "Heading 2" sz
    h3 "Heading 3" sz
    h4 "Heading 4" sz
    h5 "Heading 5" sz
    at norm-start/offset + (norm-start/size * 1x0) + 10x0
    banner "Banner" sz
    vh1 "Video Heading 1" sz
    vh2 "Video Heading 2" sz
    vh3 "Video Heading 3" sz
    vtext "Video Text" sz
    text "Document Text" sz
    

===Windows Clipboard


---Cut or Copy to Clipboard


Normal Windows cut and copy commands are supported e.g. on a field, 
contents can be copied to the clipboard. Programmatic access is also 
supported for text contents.

    across 
    label "Entry field: "
    return input-field: field 200 "Enter your text here"

    return button 200 "Copy Entry field data to clipboard" [write clipboard:// 
    input-field/text]

    return button 200 "Show Clipboard Contents" [alert read clipboard://] 


---Clearing The Clipboard


    across 
    button 200 "Clear The Clipboard" [write clipboard:// ""]

    return button 200 "Show Clipboard Contents" [alert read clipboard://] 



---Paste from Clipboard


Normal Windows paste commands are supported e.g. on a field, contents 
can be pasted. Programmatic access is also supported for text contents.

    across 

    button 200 "Show Clipboard Contents" [alert read clipboard://] 
===Requesters


REBOL View supports an assortment of requesters. 


The results of the request-* code are returned as its value e.g. 
chosen-date: request-date


---Request Yes | No | Cancel


Provides the user the capability to pick from choices "Yes" | "No" 
| "Cancel"

The result is "True" | "False" | none

    do [user-response: none]

    button "Simple Request" 200 [user-response: request "Do you want 
    to abandon your input so far?"]
    button "View User Response" 200 [alert form user-response]
    

---Pick A Color

    do [chosen-color: gold] 
    button "Pick Color" 200 [chosen-color: request-color]
    button "View Chosen Color" 200 [alert form chosen-color]



---Pick An Answer

The request allows a descriptive value then 1, 2, or 3 options.


    button "Format" 100 [request ["Your message goes here. It will wrap 
    if it is very very long." "Choice 1" "Choice 2" "Choice 3"]]
    

    button "Example 1" 100 [request ["Pick The Color of Your New Model 
    T" "Black"]]
    

    button "Example 2" 100 [request ["Pick one country" "England" "France"]]


    button "Example 3" 100 [request ["Run Extract Script?" "Yes" "No" 
    "Cancel"]]


---Pick A Date

    do [chosen-date: 01-Jun-1990]
    button "Pick Date" 200 [chosen-date: request-date]
    button "See Chosen Date" 200 [alert form chosen-date]

---Get A LogonID and Password

    do [credentials: none]
    button "Get Credentials" 200 [credentials: request-pass]
    button "View Credentials" 200 [
        view/new layout [
            size 200x200 backtile polished orange 
            across banner "Credentials" 
            return label "LogonID:  " txt pick credentials 1
            return label "Password: " txt pick credentials 2
        ]
    ]


---Pick A File


Format: REQUEST-FILE /title title-line button-text /file name /filter 
filt /keep    

        do [filter-block: ["*.gif" "*.jpg" "*.png" "*.bmp"]]

        button "Pick Any File" 300 [request-file "Select"]      

        button "Pick With A Title" 300 [request-file/title "Pick The Data 
        File to Process" "OK"]

        button "Change the Action Button Name" 300 [request-file/title "Pick 
        The Data File to Process" "OK"]        

        button "Keep Results" 300 [request-file/title/keep "Previous Select 
        On This Button Is Kept" "OK"]

        button "Filter Files" 300 [request-file/title/filter "Pick An Image 
        File" "OK" filter-block]    



---Request Text Input

Format: REQUEST-TEXT /offset xy /title title-text /default str
    

    button "Request Text Input - all default parameters" 300 [request-text]

    button "Request Text Input - with offset to window" 300 [request-text/offset 
    40x40]

    button "Request Text Input - with title" 300 [request-text/title 
    "Input your question"]

    button "Request Text Input - with default" 300 [request-text/default 
    "Key your question here"]

    button "Request Text Input - with all parameters" 300 [request-text/offset/title/default 
    100x100 "Input your question" "Key your question here"]



---Request Download from Net


Request a file download from the net. Show progress. Return none 
on error.

Format: REQUEST-DOWNLOAD url /to local-file

    backtile polished orange    

    button "Request File Download To local REBOL Cache" 300 [request-download 
    http://www.rebol.com/index.html]

    button "Request File Download To This Directory" 300 [request-download/to 
    http://www.rebol.com/index.htmlnone]

    button "Request File Download To Specific File" 300 [request-download/to 
    http://www.rebol.com/index.html%/c/temp.html]

===Message Box


    button "Format" 100 [request ["Your message goes here. It will wrap 
    if it is very very long and tedious." "Close"]] 
    button "Example" 100 [request ["You done good!" "OK"]]



---Confirmation

    button "Exit" 100 [
        request/confirm "Do you want to quit without saving?" []
    ]
    

===Calling the Editor

The REBOL editor is now callable with the editor function

    backtile polished
    button 300 "Create a test file and edit it" [
        write %temp.txt "This is a test file"
        editor %temp.txt
    ] frame 204.0.0 
    

===Calling Windows

With View/Pro the calling of executables is supported.

Here are two simple examples that will work if you have View/Pro 
on a platform where a notepad and calc are avaiable.

    across backtile size 200x200
    return button "Notepad" [call ["notepad.exe"]]
    return button "Calculator" [call ["calc.exe"]]


===Window Options


Note that these are options which are ignored by the easyvid.r code 
that displays them in this tutorial.
Copy the code out and run it standalone in REBOL/View.

---Block Options: No Border and No Title

    view/options layout [
        size 200x200 
        banner "Window Options" 
        button "Close" [unview]
        ] [
            no-border
            no-title
        ]


---Word Option: No Title


Note that the results of this are surprising if you run it from within 
a script that has a title option. It is displayed near location 0x0 
of the resulting window instead of in the window frame that has been 
suppressed. 

    view/options layout [
        size 200x200 
        banner "Window Options" 
        button "Close" [unview]
        ] 'no-title

===REBOL/View Notifiers


REBOL/View supports simple notifiers to send messages to a user interface


---Alert

    button 220 polished "Send alert message" [
        alert "This causes a dialogue box to popup"
    ]





---Flash

Flash is provided to provide a message and keep on processing.

    across size 200x200
    return button 150 "Create Flash Message" [flash "Testing"]
    return button 150 "Unview Flash" [unview]



---Inform

    inform layout  [
        backtile polished sky 

        across text font-size 16 bold underline red "Action complete!" 
        return button "OK"  [unview]]

---Popup

REBOL supports popups  (see note below before running!)

        across size 200x200 
        button "Show Popup" [
            show-popup popup-layout: layout [
                    across size 200x200 
                    backtile polished
                    banner "The Popup Worked" 
                    return button "Unview" [unview]
                ]
        ]
        return button "Hide Popup" [unview/only popup-layout]

I have had some difficulties (process lockup) when using

these popups so just use view layout [...] and skip the popup part.

===Diagram Example


Carl has created some diagrams in REBOL using styles to make an architecture 
diagram.

This is a slightly modified version.


Here again a DO block precedes the layout code for non-layout initiatiation 
... here the definition of a function.

Why make a diagram this way?


1. One reason is that it can be interactive ... the sections are 
all "hot" with a few lines of code.  Here they pop up REBOL Dialogs 
but they could do anything that can be coded even something as simple 
as launching a browser on a different URL for each diagram component. 
 The "Compositor" box demonstrates this by launching your browser 
on the REBOL.com site.


2. Very small footprint size compared to other presentation source 
formats.




 do [
        information: func [info [string!]][
        request/ok reform [ info]
    ]
 ]



    style bx box 255.255.255 0.0.0 font-size 11 font [color: 0.0.0 shadow: 
    0x0] edge [size: 5x2] 
        [request/ok reform ["No information on" face/text]] 

    style bb box bold left top para [origin: 6x10] edge [size: 2x2]
        [request/ok reform ["No information on" face/text]]
    backcolor silver + 30
    at 15x15 h1 486 left "Arch Structure" 
    at 15x50    bb "Client" 506x436 160.80.80 [

        information "Any client machine e.g. branch or Call Centre"]

    at 25x252   bb "Mid-Tier" 486x68 effect [gradient 1x1 169.91.155 
    80.45.75]

    at 25x152   bb "UI" 486x96    effect [gradient 1x1 38.156.82 19.78.41]

    at 25x324   bb "Servers" 486x151   effect [gradient 1x1 103.96.200 
    50.45.100] [

        information "Mid-tiers servers with XYZ relational database server" 
                                                                         
              
    ]

    at 130x216  bx "Compositor" 182x24 bold [browse http://www.rebol.com]

    at 130x60   bx "Browser" 120x24 [information "Branch standard browser"]

    at 130x188  bx "Sound" 182x24 bold [information "Sound services"]
    at 255x60   bx "Win32" 120x24 [information "Win32 App"]

===Column Images


Creates a layout looking (a little) like columns. It uses a gradient 
effect going from darker to lighter

 do [
     column: make image! layout [

            backdrop effect [gradient 1x0 20.20.20 250.240.230 luma 60]
        ]

    column-size: 50x420

    area-size: 400x420  ; height should be the same as column-size
 ]
 backtile polished tan
   across 
   image column-size  column 
   pad -10x0        ; this brings the default VID spacing back
   area wrap area-size  

   edge none        ; take the edge off of area so that it more closely 
   blends 
   shadow 2x2

   pad -10x0 image column-size column  ; if you want a right column

===Tree View of Directory

This is Didier's tree view %request-dir.r


In this sample, you must be online because the code is accessed on 
the Rebol script server

 do [do http://www.rebol.org/library/scripts/request-dir.r
     request-dir
 ]


Note that:

* the script is read from the script library but runs locally

* it is showing the files in your directories


===The emailer Function


The function for emailing has appeared in Jan-2004 on the rebol list.


It is a simple idea ... to create a standard emailer by invoking 
a function emailer. This window will show the source:

  text wrap 400x300 mold get 'emailer

And it is simple to run:

    across size 200x200
    return button 150 "Run emailer" [emailer]


But on my machine there is again a problem - the emailer locks up 
REBOL/View.

Recommendation:

* if it works use it if you like


* use Doc Kimbel's one liner (works for me). Assumes you have set 
up your email in set-user



 e: field "Email" s: field "Subject" m: area "Body" btn "Send"[send/subject 
 to-email e/text m/text s/text alert "ok"]



* better yet, make your own... if the code for the basic is 1 line, 
then a custom version is not far away. Here's an example that allows 
selection of your frequent contacts (entered in the names-addresses 
series) and keeps a journal of email that you have sent (using this 
code) in file email-journal.txt.  Assumes you have setup your user 
profile correctly to allow sending of email.


 do [

  names-addresses: [
    "Contact 1"         [contact1-:-no-such-address-:-com]
    "Contact 2"         [contact2-:-no-such-address-:-com]
    "Contact 3"         [contact3-:-no-such-address-:-com]
  ]

  names: copy []
  foreach [name address] names-addresses [append names name]


  journal?: false  ; set to true if want to journalize sent email
 ]

    e: rotary 200 data sort names
    s: field "Subject" 
    m: area 500x400 wrap "Body" 
    btn "Send"[

        send/subject who-to: select names-addresses e/text m/text s/text 
        alert join "Sent email to: " form who-to
        
        if journal? [
            write/append %email-journal.txt rejoin [
                "[ When-sent: " now/precise 
                " To: " who-to
                " Subject: {" s/text
                "} Message: {" m/text "} ] "
                newline
            ]
        ]
    ]
    btn "Quit" [unview]



It won't take much to change this from the rotary used to a text 
list allowing multiple selections.





===Some More email


Earlier there have been a few examples of sending email. Here are 
a few more that often appear in the mailing list

---Simple Send


This is not a runnable version because you don't need anything but 
REBOL/Core to run it. It has been wrapped in a DO block so it does 
not send errors to the console.

---Quick Send Short Message

 do [
    send [address-:-isp-:-com] "My Message"
 ]
 
---Send Longer Message  

Now a more complex message where there is a body to the message:

 do [
    send [address-:-isp-:-com] {Sample Message
               
    This is the body of the message
    } 
 ]

---Send with One Attachment


Here, so that the sample does not fail, test file(s) are created 
by the code before attempting the send. 

 do [
    test-file: %file-attachment.txt
    write test-file {Just some test data to create a file}
    send/attach [address-:-isp-:-com] {Sample Message
               
    This is the body of the message
    } test-file
 ]
 
---Send with Attachments

And a message with multiple attachments.


Here, so that the sample does not fail, test file(s) are created 
by the code before attempting the send. 

 do [
    files: [%file-attachment.txt %second-attachment.txt]

    foreach file files [write file {Just some test data to create a file}]
    send/attach [address-:-isp-:-com] {Sample Message
               
    This is the body of the message
    } files
 ]
 
---Send to Multiple Addresses


Here, so that the sample does not fail, test file(s) are created 
by the code before attempting the send. 

 do [
    files: [%file-attachment.txt %second-attachment.txt]

    foreach file files [write file {Just some test data to create a file}] 

    send/attach [[address-:-isp-:-com][asecondAddress-:-isp-:-com]] {Sample Message
               
    This is the body of the message
    } files
 ]
 
---Send/only

Same send only just provide the SMTP server with one copy:

Here, so that the sample does not fail, test file(s) are created 
by the code before attempting the send. 

  do [
    files: [%file-attachment.txt %second-attachment.txt]

    foreach file files [write file {Just some test data to create a file}] 

    send/only/attach [[address-:-isp-:-com][asecondAddress-:-isp-:-com]] {Sample 
    Message
               
    This is the body of the message
    } files
 ]
 
---Send With Header


This example uses a Do block to wrap the code. If you execute the 
email should be sent.
But it is unlikely to be delivered.


The addresses for me and you should be changed in your use as well 
as the

* Subject

* Organization

* Content 

 do [
   me: [myaddress-:-isp-:-com]
   you: [youraddress-:-isp-:-com]
   header-object: make system/standard/email [
            From: me
            Reply-To: me
            Subject: "Some Stuff"
            Organization: "Cyberia"
            MIME-Version: 1.0 
            Content-Type: "text/plain"
    ]
 send/header you {Test Message
    This is the message body.
    }                 
    header-object 
 ] 

---Send with CC

This adds a copy value in the header-object

 do [
   me: [myaddress-:-isp-:-com]
   you: [youraddress-:-isp-:-com]
   header-object: make system/standard/email [
            From: me
            Reply-To: me
            Subject: "Some Stuff"
            Organization: "Cyberia"
            MIME-Version: 1.0 
            Content-Type: "text/plain"
        cc: [another-address-:-isp-:-com]
    ]
 send/header you {Test Message
    This is the message body.
    }                 
    header-object 
 ] 


   
---Doctored Code

Again Doc Kimbel's one liner that does not waste a character


 e: field "Email" s: field "Subject" m: area "Body" btn "Send"[send/subject 
 to-email e/text m/text s/text alert "ok"]


===Sharp Styles


I really like the style that Didier has put around his email previewer

 do [
    ss-light: stylize [
        text: text feel none
        vtext: vtext feel none
        col-hdg: text black 255.255.204 bold middle effect []
        col-txt: text edge [size: 1x0 color: gray effect: 'bevel]
        ban: vh3 left to-pair reduce [
            50 logo.gif/size/y] edge [

                color: 0.0.0 size: 0x1] feel none with [color: black]
        lab: label para [origin: 2x3 margin: 0x2]
        labe: lab edge [size: 1x1 color: water effect: 'ibevel]
        inf: info 100 font-color yellow
        bkg: backdrop water - 10.10.10
        txt-big: vtext 300 font-size 18 font-color yellow center
        rti: vtext font-size 14 bold
        txt-ch: rti font-color white 170x22 para [
            origin: 2x3] with [font: make font [
                    color: white] colors: [55.95.155 235.170.55]]
        btnb: btn 70.70.70 font-color white

        men: rti 264 edge [size: 1x1 color: water effect: 'bevel] para [origin: 
        20x2 margin: 1x4]

             with [color: water - 40.40.40 effect: first effects: [

                [draw [pen white fill-pen white polygon 5x2 13x10 5x18]] [draw [pen 
                white fill-pen white polygon 2x5 10x13 18x5]]
             ] feel: none]  ;system/view/vid/vid-feel/hot]

        cbox: box 60x20 edge [size: 1x1 color: water effect: 'bevel] [

            if temp: request-color/color first face/data [face/color: temp change 
            face/data temp show face]
        ] with [append init [color: first data]]
    ]
    stylesheet: ss-heavy: stylize/styles [

        col-hdg: col-hdg effect [gradcol 0x1 200.200.160 155.155.104]

        ban: ban effect [merge gradcol 150.180.200 0.0.0] with [color: none]

        bkg: backdrop effect [gradient 1x1 65.125.175 45.75.115 grid 2000x4 
        1999x4 70.130.190 blur]
        txt-big: vtext 300 font-size 18 font-color yellow center
        rti: vtext font-size 14 bold

        txt-ch: txt-ch effect [gradcol -1x1 105.105.105 151.151.151]
        men: men effect [gradcol -1x0 black water]
    ] ss-light
 ]
    styles stylesheet
    space 4x4 origin 4x4 across
    bkg
    pad 15 ban 235 :title para [origin: 32x0]
    pad -254
    image 30x30 %palms.jpg effect [fit key 255.0.255]
}
code: text: layo: external-view: none
sections: []
layouts: []
space: charset " ^-"
chars: complement charset " ^-^/"

rules: [title some parts]

title: [text-line (title-line: text)]

parts: [
      newline
    | "===" section
    | "---" subsect
    | "!" note
    | example
    | paragraph
]

text-line: [copy text to newline newline]
indented:  [some space thru newline]
paragraph: [copy para some [chars thru newline] (emit txt para)]
note: [copy para some [chars thru newline] (emit-note para)]
example: [
    copy code some [indented | some newline indented]
    (emit-code code)
]

section: [
    text-line (
        append sections text
        append/only layouts layo: copy page-template
        emit h1 text
    ) newline
]
subsect: [text-line (emit h2 text)]
emit: func ['style data] [repend layo [style data]]
emit-code: func [code] [
    remove back tail code
    repend layo ['code 460x-1 trim/auto code 'show-example]
]
emit-note: func [code] [
    remove back tail code
    repend layo ['tnt 460x-1 code]
]

show-example: [

    if external-view [xy: external-view/offset  unview/only external-view]
    xcode: load/all face/text
    if not block? xcode [xcode: reduce [xcode]] ;!!! fix load/all
    if here: select xcode 'layout [xcode: here]
    external-view: view/new/offset layout xcode xy
]

page-template: [
    size 500x480 origin 8x8
    backdrop white - 80

    style code tt snow navy bold as-is para [origin: margin: 12x8]
    style tnt txt maroon bold
]

parse/all detab content rules
show-page: func [i /local blk last-face][
    i: max 1 min length? sections i
    append clear tl/picked pick sections i 
    if blk: pick layouts this-page: i [
        f-box/pane: layout/offset blk 0x0 
        last-face: last f-box/pane/pane    ; bh slider

    f-box/pane/pane/1/size: f-box/pane/size: max 500x480 add 20x20 add 
    last-face/offset last-face/size ; bh slider
    update-slider ; bh slider
        show f-box
    ]

    show tl    ; changed to after slider update ; was not refreshing 
    the index display
]


update-slider: does [
    sld/data: 0
    either object? f-box/pane [
        sld/redrag min 1.0 divide sld/size/2 f-box/pane/size/2
        sld/action: func[face event] compose [

            f-box/pane/offset/2: multiply face/data (subtract 480 f-box/pane/size/2)
            show f-box
        ]
    ][
        sld/redrag 1.0 show sld
        sld/action: none
    ]
    show sld
]

main: layout [
    backtile polished
    across
    vh2 title-line return
    tl: text-list 160x480 bold black white data sections [
        show-page index? find sections value
    ]
    h: at
    f-box: box 500x480

  at h + 500x0 sld: slider 24x480                 ; add brett's slider
    at h + 456x-24
    across space 4
    arrow left  keycode [up left] [show-page this-page - 1]
    arrow right keycode [down right] [show-page this-page + 1]
    pad -150

    txt white italic font-size 16 form system/script/header/date/date
]

show-page 1
xy: main/offset + either system/view/screen-face/size/x > 900 [
    main/size * 1x0 + 8x0][300x300]
view main
Group: View ... discuss view related issues [web-public]
Ashley:
27-Feb-2005
A question for those who have delved into View facets; which facets 
(apart from 'data) are *not* used by View? 'action seems to be reserved 
for the VID feel system, 'span seems to have an undefined effect 
if used. The complete list is:

	type: 'face
	offset: 0x0
	size: 100x100
	span: none
	pane: none
	text: none
	color: 200.200.200
	image: none
	effect: none
	data: none

 edge: make object! [color: 200.200.200 image: none effect: none size: 
 2x2]

 font: make object! [name: "arial" style: none size: 12 color: 0.0.0 
 offset: 2x2 space: 0x0 align: 'center valign: 'center shadow: none]

 para: make object! [origin: 2x2 margin: 2x2 indent: 0x0 tabs: 40 
 wrap?: true scroll: 0x0]

 feel: make object! [redraw: none detect: none over: none engage: 
 none]
	saved-area: none
	rate: none
	show?: true
	options: none
	parent-face: none
	old-offset: none
	old-size: none
	line-list: none
	changes: none
	face-flags: 0
	action: none


I'm trying to determine which facets I can safely use when not using 
VID.
Micha:
5-May-2005
sortuj: [  items:  sort/compare  items func [a b ][(pick a n) < pick 
b n]
            save %data.txt items          
            show lay              ]


dodaj: [a: to-url tx/text 

        items: append array/initial 1 reduce [ a  [] [] [] ] items 
        show lay  ]


p:  [    field 200  field 100  field  100  field 100  field 100 return]


add: func [ /local coll] [ coll: get in  layout/offset/origin p  
0x0 1x1 'pane
                           insert tail sub-panel/pane coll  ]

sub-panel: layout [space 2x2
        across 
        origin 1x1
        ; style label text bold right 60
        backcolor blue

       field 200  field 100  field  100  field 100  field 100 return

       field 200  field 100  field  100  field 100  field 100 return 


          ]


lay: layout [

    origin 5x5
    space 1x0
              
 across

   txt 20 "url"    tx: field  270 txt 30 "add" [do dodaj] txt 100 center 
   "sprawdz" [] 
 return
        
 across
h3 200 center red "www" [n: 1  do sortuj   ] 
h3 100 center red "ip"[n: 2 do sortuj ] 
h3 100 center red "nazwa" [n: 3  do sortuj ]
h3 100 center red "kraj" [n: 4 do sortuj]
h3 100 center red "agent" [n: 5  do sortuj ]
 return
        space 0
        panel: box  610x400 blue
        s1: scroller 16x400 [scroll-panel-vert panel s1]
        return
        s2: scroller 300x16 [scroll-panel-horz panel s2]
        return
        button "halt" [halt]
    ]

    panel/pane: sub-panel

    scroll-panel-vert: func [pnl bar][

        pnl/pane/offset/y: negate bar/data * (max 0 pnl/pane/size/y - pnl/size/y)
        show pnl
    ]

    scroll-panel-horz: func [pnl bar][

        pnl/pane/offset/x: negate bar/data * (max 0 pnl/pane/size/x - pnl/size/x)
        show pnl
    ]

    update-panel: func [pnl vbar hbar] [
        pnl/pane/offset: 0x0
        s1/data: s2/data: 0
        hbar/redrag pnl/size/x / pnl/pane/size/x
        vbar/redrag pnl/size/y / pnl/pane/size/y
        
        show [pnl vbar hbar]
    ]

    update-panel panel s1 s2
    view/new lay

do-events
MikeL:
16-Sep-2005
Now if you will remind me how to add to easily (View 1.3) add a text 
area vertical scroll, we can be even.  I can't locate a good example.
Graham:
18-Nov-2005
so, I guess if you have mixture of text and graphics, you have to 
scroll the pane?
Volker:
16-Dec-2005
s: copy""
repeat i 300[repend s [ i newline ]]
help text-info
view layout[ across
 ta: area s para[]  
 slider 16x150 [scroll-para ta face]
 return
 info rate 1 feel[  engage: func[face a e][

  set-face face either all[system/view/caret same? ta system/view/focal-face][
   lines: parse/all copy/part ta/text system/view/caret "^/"   
   form length? lines  
  ][
   "none"
  ]
 ]]  
]
Robert:
28-Dec-2005
How to add scroll-wheel support to a text-list?
Henrik:
28-Dec-2005
Sorry, Robert. There is something I want to announce. :-)


http://hmkdesign.dk/list-test.png<--- a picture of the list view 
I'm building.


Currently about half done and quite usable at this time: It's resizable. 
Values are stored as blocks of blocks. All columns can be sorted. 
Input columns can be filtered so you can show only some columns. 
Columns can be freely reordered (but not in the GUI yet). One arbitrary 
column can be resized.

It has the normal range of series manipulation functions available 
in REBOL. There is also possibility for inline editing, by doubleclicking 
a line. Changed values are automatically stored in the list. All 
such operations are "bundled" in the list view VID code and you only 
need to provide whatever functions needed to store the list data 
in an external place. If a text entry is too wide, it'll be neatly 
cut with ellipsis (...).

Filtering function, to filter input by rows. Also has a scroll-to-selected-line 
function.

It's about as fast as the current LIST in VID, since it really is 
LIST with just a whole bunch of extra functions to make general list 
views easy. There are functions possible for clicking and double 
clicking and functions for retrieving rows and columns.


Current limitations: No mouse over indication (can't make it fast 
enough). Only one resizable column. No keyboard navigation. No horizontal 
scrolling. No scroll-wheel support. It doesn't integrate 100% with 
VID yet. I'm using some of my own widgets and bitmap graphics from 
a pretty big GUI library. Stripe look, font and coloring is locked. 
No standard settings yet for the list view.

All code is about 250 lines.


Planning: Reordering columns via drag'n'drop. Column resizing, if 
I can figure it out. Format the font object conditionally from list 
input (make this line bold if the age column is > 45 years, etc.). 
Grid drawing. Images in list rows. And if I can get around to it: 
Single cell in-line editing ala spreadsheets. :-)
DideC:
23-Jan-2006
I have done some work on it for the word-browser. Just look the code 
(desktop\rebol.com\tools\word-browser) :

- There is a patch to the resize function (maybe you can use it to 
refresh the list to the same size?) line 65

- There is a scroll-text-list func (line 414) that is called by the 
window/feel (line 381) for the mouse-wheel
Maxim:
18-Jan-2007
using scroll offset, window width you can select a line of text immediately.
james_nak:
6-Oct-2007
You know when you want to update an area object, if you replace the 
text how do you make the cursor go to the home position? Outside 
of setting the para/scroll, there's some other value hanging around 
(I'm tired of looking for it with anamonitor!)
amacleod:
31-Jul-2008
Still working with Anton's Scroll-panel...

I found a way to "index" the text location in the scroll panel as 
I build the layout. But when I try to set the offset to a specific 
position in the scroll panel I offset the whole "face" and not a 
reposition of the scroller. 
Example- 
I set my_scroll_panel/offset/y: 200

I feel I should be setting the scroller's value but I can  not seem 
to figure out how...
amacleod:
7-Aug-2008
New problem with Anton's scroll-panel style. 

When I select text I loose mouse scroll-wheel use and Keyboard scroll 
functionality.


Altme does not have this problem. I guess it's inherent to the style.
amacleod:
7-Aug-2008
I'm able to re-focus the scroll panel within my "clip" function (to 
save the highlighted text) but if I just click in a text area or 
highlight and not save it using hte clip function I can not get scrolling 
back.
BrettH:
8-Aug-2008
I have a similar problem re: scrolling, and I've tried the suggstions 
by amacleod without success, here I've copied a modified version 
of cookbook-scroller in the hope someone can suggest a solution.Hi, 
I'm trying to write a data entry form with many fields, this form 
is longer than a typical
monitor viewing area.

Creating the form is easy, but I cannot work out how to scroll the 
whole form 'up/down'

when the user TAB's out of the last showing field bottom and display 
the 'hidden' fields.

Rebol actually does TAB to the next field and accepts data entry 
but you cannot see it
without manually moving the scroll slider.


How do I programmatically make the form 'move' up/down ? and sync 
the slider ?

 I've tried "all" the example code I can find and none seem to do 
 the trick :-)


In the attached (modified cookbook-scroller.r) program I've added 
a few fields to illustrate the

problem. My need is for rapid data entry and using the mouse is really 
not a option, The program accepts user data, user TABS to navigate 
to next field, form slides as necessary, upon last field, data is 
saved, form cleared, cursor placed at first field, data entry continues.

Thanks for any ideas.

;; ===============================
  rebol ["cookbook-scroller2.r"]
  sub-panel: layout [
        across origin 5
        style label text bold right 60
        backcolor tan
        h2 leaf "Scrolling Sub Panel" return
        label "Name:" f1: field return
        label "Email:" f2: field return
        label "Info:" f3: area wrap return
        label "Month:"
        l1: text-list data system/locale/months return
        label "Day:" s1: slider 200x20 return
        label
        button "Submit"
        button "Cancel" [quit]
    ]

    out: layout [
        across
        h3 "Panel Scrolling Example" return
        space 0
        p1: box 300x300 coal frame black
        s1: scroller 16x300 [scroll-panel-vert p1 s1]
        return
        s2: scroller 300x16 [scroll-panel-horz p1 s2]
        return
    ]

    p1/pane: sub-panel

    scroll-panel-vert: func [pnl bar][
        pnl/pane/offset/y: negate bar/data *
            (max 0 pnl/pane/size/y - pnl/size/y)
        show pnl
    ]

    scroll-panel-horz: func [pnl bar][
        pnl/pane/offset/x: negate bar/data *
            (max 0 pnl/pane/size/x - pnl/size/x)
        show pnl
    ]

    update-panel: func [pnl vbar hbar] [
        pnl/pane/offset: 0x0
        s1/data: s2/data: 0
        vbar/redrag pnl/size/y / pnl/pane/size/y
        hbar/redrag pnl/size/x / pnl/pane/size/x
        show [pnl vbar hbar]
    ]

    update-panel p1 s1 s2
    view out
;; ============
BrettH:
9-Aug-2008
Solved !!! Took a bit of fiddling around, but now the form moves 
down thru the fields

as the user tabs out of a filed, and slides back to first field on 
tab out of last field.
Mouse positioning via scroll bar still working.

I left the trace print code in so you can observe its operation.


See the comments in teh code for the changes I made to cookbook-scroller.r

Now to try it with my own form.

;; ==============================================
rebol ["cookbook-scroller-2-1.r"
       author "Brett Hallett 2008 "
	comment  { 

    Modified  cookbook-scroller.r program  to code automatic scrolling 
    of fields on TAB,

    allows the form to have fields off the viewable page and automatically 
    scroll up/down 
	   as the user leaves a field using TAB.

    -- display field position on TAB -- eg:  print  [ "f1 "  f1/offset] 
     ( for testing only !)

    -- scroll-panel-vert func modified with extra parameter  ( a fields 
    y offset )

    -- compute offset value before calling scroll-panel-vert in out: 
    layout ( stops scroller aborting !)
	  }
	 ]

 sub-panel: layout [
        across origin 5
        style label text bold right 60
        backcolor tan
        h2 leaf "Scrolling Sub Panel" return

        label "Name:" f1: field [ print  [ "f1 "  f1/offset]        scroll-panel-vert 
        p1 s1 f1/offset/y ] return

        label "Email:" f2: field  [ print  ["f2 " f2/offset]          scroll-panel-vert 
        p1 s1 f2/offset/y ] return

        label "Info:" f3: area wrap [ print  ["f3 " f3/offset]     scroll-panel-vert 
        p1 s1 f3/offset/y ] return
	

  label "More info: " f4: field [ print  ["f4 " f4/offset]      scroll-panel-vert 
  p1 s1 f4/offset/y ] return

  label "Even more ;" f5: field [ print   ["f5 " f5/offset ]  scroll-panel-vert 
  p1 s1 f1/offset/y 
							print "write collected data"
							clear-fields sub-panel ] return

  ;; notice how the first field offset is used to set the scroll position 
  on last field exit
	 
        button "Submit" [ print "Press Submit "]
        button "Cancel" [ print "Quit" quit]
    ]

    out: layout [
    
        across
        h3 "Panel Scrolling Example" return
        space 0
        p1: box 300x300 coal frame black

        s1: scroller 16x300 [scroll-panel-vert p1 s1  ( s1/data * (max 0 
        p1/pane/size/y - p1/size/y)) ]
				;; compute offset value before calling scroll-panel-vert
        return
        s2: scroller 300x16 [scroll-panel-horz p1 s2]
        return

    ]

    p1/pane: sub-panel


;; scroll-panel-vert modified with extra parameter : fldoffset ( 
the y offset of the TAB'ded out of field )
      scroll-panel-vert: func [pnl bar fldoffset][
        pnl/pane/offset/y: negate fldoffset
	 print ["pnl-vert " pnl/pane/offset/y]
        show pnl

    ]

    scroll-panel-horz: func [pnl bar][

        pnl/pane/offset/x: negate bar/data * (max 0 pnl/pane/size/x - pnl/size/x)
        show pnl
    ]

    update-panel: func [pnl vbar hbar] [
        pnl/pane/offset: 0x0
        s1/data: s2/data: 0
        vbar/redrag pnl/size/y / pnl/pane/size/y
        hbar/redrag pnl/size/x / pnl/pane/size/x
        show [pnl vbar hbar]
    ]
   
    update-panel p1 s1  s2
     view out
BrettH:
16-Aug-2008
I had another look at the scroller problem, and I'm beginning to 
see that it really does not work !
eg:

 == the scroll bar does not 'follow' the offset in the pane even when 
 its new position is calculated and set

        == does not seem to be anyway to adjust the size of the moving bar 
        itself. Unable to find any documentation.

 == even with calculating the length of the (sliding) form against 
 its (viewable) panel length, 
           the offset 'action' for TAB 

           is not consistent in that the last form field is not always viewable 
           by the tab action 

           -- seems to be dependent upon the relationship between form length 
           and panel size which you can adjust manually 

              but thats hardly a useful solution. When you add a field the whole 
              scroller stops working. ( Flaky !)
        == pretty disapointing really.


Whats needed is a scroller that can be defined to operate with any 
pane and automatically following the field tabbing
in that pane without coding required. "Follow the source --Luke!"

Heres the latest code effort !

;;======================================================
rebol ["cookbook-scroller-2-11.r"
       author "Brett Hallett 2008 "
	comment  { 

    Modified  cookbook-scroller.r program  to code automatic scrolling 
    of fields on TAB,

    allows the form to have fields off the viewable page and automatically 
    scroll up/down 
	   as the user leaves a field using TAB.

    -- display field position on TAB -- eg:  print  [ "f1 "  f1/offset] 
     ( for testing only !)

    -- scroll-panel-vert func modified with extra parameter  ( fields 
    y offset )

    -- compute offset value before calling scroll-panel-vert in out: 
    layout
	   -- move trace to func print-pos for easier modification
	  }
	 ]

 sub-panel: layout [  size 300x350
        across origin 0
        style label text bold right 60
        backcolor green
        h2 leaf "Scrolling Sub Panel" return

        label "Name:" f1: field       [ print-pos   "f1 " f1/offset   scroll-panel-vert 
        p1 s1 f1/offset/y ] return

        label "Email:" f2: field        [ print-pos   "f2 " f2/offset   scroll-panel-vert 
        p1 s1 f2/offset/y ] return

        label "Info:" f3: area 199x115 wrap  [ print-pos  "f3 " f3/offset 
          scroll-panel-vert p1 s1 f3/offset/y ] return
	

  label "More info: " f4: field   [ print-pos   "f4 " f4/offset   scroll-panel-vert 
  p1 s1 f4/offset/y ] return

 ;;  label "More info: " f41: field   [ print-pos   "f41 " f41/offset 
   scroll-panel-vert p1 s1 f41/offset/y ] return

  ;;label "More info: " f42: field   [ print-pos   "f42 " f42/offset 
    scroll-panel-vert p1 s1 f42/offset/y ] return

  label "Last  ;" f5: field [ print-pos   "f5 " f5/offset   scroll-panel-vert 
  p1 s1 0 
							print "write collected data"
							clear-fields sub-panel ] return 

 ;; notice how the  offset of zero is used to set the scroll position 
 to top of form on last field exit
	below
	pad 5
	below
    ]

btn-panel: layout [
        across
	 button "Submit" [ print "Press Submit "]
        button "Cancel" [ print "Quit" quit]
	]
	
main-form: layout [
        across
        h3 "Panel Scrolling Example" return
        space 0
        p1: box 	  300x250 coal frame black

        s1: scroller 16x250 [scroll-panel-vert p1 s1  ( s1/data * (max 0 
        p1/pane/size/y - p1/size/y))  ]
				;; compute offset value before calling scroll-panel-vert
        return
	  p2: box 300x50

    ]
 
print-pos: func [ fld pos ] [ print ["print-pos: "  fld  pos]]


;; scroll-panel-vert modified with extra parameter : fldoffset ( 
the y offset of the TAB'ded out of field )

scroll-panel-vert: func [pnl bar fldoffset][
	
	;; print [ "slider:" ( (max 0 p1/pane/size/y - pnl/size/y))]

        if fldoffset < ( (max 0 p1/pane/size/y - pnl/size/y))  [ pnl/pane/offset/y: 
        negate fldoffset ]
	
	;; print ["pnl-vert " pnl/pane/offset/y  fldoffset]
        show pnl

    ]

update-panel: func [pnl vbar  pnl2] [
        pnl/pane/offset: 0x0
        s1/data:  0
        vbar/redrag pnl/size/y / pnl/pane/size/y
        pnl2/pane/offset: 0x0
        show [pnl vbar pnl2]
    ]
   
    p1/pane: sub-panel
    p2/pane: btn-panel
   
    update-panel p1 s1  p2
  
    view main-form

;; ==========================
Anton:
18-Aug-2008
amacleod, the "selected text prevents scrolling in scroll-panel" 
problem is not the fault of scroll-panel.

demo-scroll-panel.r shows this problem because I didn't want to make 
it too complex, by including the necessary global event handler to 
handle scroll events on non-focused scrolling faces (such as scroll-panels). 
I do have a demo somewhere which has the necessary global event handler 
somewhere... at least style-gallery.r uses it.
amacleod:
19-Aug-2008
Anton,  I notice in your demo-scroll-wheel-handler.r if I add some 
text to the scroll-panel itself (not in a scroll-area) teh scroll 
wheel continues to work but you loose page down.up and arrow key 
function. I guess it looses focus. If you click on hte panel you 
get it back.

Is there a way to retain it without needing to manually resetting 
it?
Anton:
20-Aug-2008
amacleod, do you mean adding a TEXT like this:
	scroll-panel [
		text "hello"
	]
and clicking on the text?

The TEXT gains the focus (and can be selected and copied etc.), but 
since the scroll-panel no longer has the focus it doesn't get arrow 
keys etc.
You could make the TEXT inactive by setting its FEEL to none:
	scroll-panel [
		text "hello" feel none
	]

or you could modify its feel to route particular keys such as page-up/page-down 
and arrow keys to the scroll-panel it's in.
	text "hello" feel [
		append last last second :engage bind [
			if find [up down page-up page-down] event/key [

    face/parent-face/parent-face/parent-face/feel/engage face/parent-face/parent-face/parent-face 
    act event
			]
		] first find second :engage 'act
	]
Not particularly easy, but there you go.

I have thought about this issue before, but didn't come up with a 
clear vision of how to handle it properly yet, I think.
Maxim:
3-May-2009
I could use the scroll, but since its a field, the moment I enter 
text, the scroll goes back its default, which is badly aligned with 
the fields I am trying to get clean  \ :-(
amacleod:
16-May-2009
Sorry Anton, Yes I'm using your scroll-panel  in R2. I was not the 
scroll panel that was the issue but how to get each occurance of 
a specific word from the face/text
Maxim:
17-Apr-2010
so far,


fields: clipping text to field area (which can be smaller than the 
field itelf.

frames: clipping contents to frame bounds (just like faces in R2). 
this allows us to scroll frames within frames.


for frames the clipping isn't something I can ignore  it will have 
to work somehow.
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public]
RobertS:
31-Aug-2007
; I did a dif between the functions in VIEW and those in CORE for 
a default install.  What I get is this ( I hope it is useful to have 
al 106  in one place )

 alert  brightness?  caret-to-offset  center-face  choose  clear-face 
  clear-fields  confine  crypt-strength?

 dbug  deflag-face  desktop  dh-compute-key  dh-generate-key  dh-make-key 
  do-events  do-face  do-face-alt  do-thru  

 draw  dsa-generate-key  dsa-make-key  dsa-make-signature  dsa-verify-signature 
  dump-face  dump-pane  edge-size?  

 editor  emailer  exists-thru?  find-key-face  find-window  flag-face 
  flag-face?  flash  focus  get-face  

 get-net-info  get-style  hide  hide-popup  hilight-all  hilight-text 
  hsv-to-rgb  in-window?  inform  

 insert-event-func  inside?  install  launch-thru  layout  link-relative-path 
  load-image  load-stock  

 load-stock-block  load-thru  local-request-file  make-face  notify 
  offset-to-caret  open-events  outside?  

 overlap?  path-thru  read-net  read-thru  remove-event-func  request 
  request-color  request-date  request-dir  

 request-download  request-file  request-list  request-pass  request-text 
  reset-face  resize-face  rgb-to-hsv  

 rsa-encrypt  rsa-generate-key  rsa-make-key  screen-offset?  scroll-drag 
  scroll-face  scroll-para  set-face  

 set-font  set-para  set-style  set-user  show  show-popup  size-text 
  span?  stylize  textinfo  unfocus  

 uninstall  unlight-text  unview  vbug  view  viewed?  win-offset? 
  within?
Group: Linux ... [web-public] group for linux REBOL users
MaxV:
10-Mar-2011
May you explain me why this works under Linux and no font PATH is 
requested? 
REBOL [
	title: "SW-like scroller by Cyphre"
	author: [cyphre-:-seznam-:-cz]
]

scr-size: 640x220
scrl: scr-size * 0x1
c1: scrl
c2: as-pair scr-size/x / 2.5 scr-size/y / 5
c3: as-pair scr-size/x - (scr-size/x / 2.5) c2/y

view/new layout [
	origin 0

 bx: box scr-size effect [draw [] gradcol 0x-1 sky black] with [feel: 
 none]
]

while [not empty? system/view/screen-face/pane][
	scrl/2: scrl/2 - 1

 img: to-image t-face: make face [edge: none color: black size: scr-size 
 text: system/license font: make font [size: 20 style: 'bold color: 
 white] para: make para [scroll: scrl]]
	if scrl/y < - second size-text t-face [
		scrl/y: c1/y
	]
	bx/effect/draw: [
		pen black
		fill-pen black
		box 0x0 scr-size
		image img c2 c3 scr-size c1
	]
	show bx
	wait 0
]

???????
Group: AGG ... to discus new Rebol/View with AGG [web-public]
Pekr:
29-Oct-2008
My non professional guess is, that your area code would need to be 
rewritten for R3 anyway ... we now have gobs, rich-text, etc. But 
your area style would be nice to have for R3 GUI. IIIRC your area 
can scroll, when you hilite text by mouse.
Group: Web ... Everything web development related [web-public]
Pekr:
30-Jan-2005
css may well try to isolate presentation layer, but imo it fails. 
You have box aproach, but let's relate it to VID area - the text 
in css terms will hide, if it is longer than the visible area, but 
- where is scroll-bar? Correct me if I am wrong, but you simply need 
'if and other good functions to program it exactly the way you want 
...
Oldes:
25-Jan-2007
Yes, I did, and if you scroll a little bit up, you can find the link 
easilly - it's in big yellow block of text:) And I agree, that it 
would be good to have cookies support directly in Rebol, as my cookies-daemon 
is relly hard hack I cannot be sure that it would not rewrite some 
future http protocol updates
Group: Announce ... Announcements only - use Ann-reply to chat [web-public]
Maxim:
27-Jan-2011
GLASS RELEASE 002
---------------------------

released last week, but posting it here to make it easier to find, 
since the GLASS group has a lot of discussion in it....

http://www.pointillistic.com/open-REBOL/moa/files/glass-r002.zip


-adds the editor style, which is now able to show text and scroll 
in real-time, but still has no keyboard handling yet.
-adds a few new more advanced tutorials

-adds a new demo app which is the basis for a full text-editor in 
REBOL (you can use the load button which allows you to load text 
within the editor, it loads files almost instantaneously... I was 
surprised how quickly it loaded even 1MB files), file size doesn't 
change editor refresh speed..

very extensive history of changes, 
very extensive TO DO list

some improvements to libs here and there.
Group: SDK ... [web-public]
amacleod:
4-Mar-2009
I'm also getting a lot of "misplaced item" errors but again only 
in encapped version....

Unknown word or style: rejoin
Misplaced item: ["This version: " this_version]
Unknown word or style: rejoin
Misplaced item: ["Last Update: " last_db_update/date]
Misplaced item: 150
Misplaced item: "6-TOWE"
Misplaced item: [get_sections cur_chap: copy face/text]
Misplaced item: 450
Unknown word or style: red
Unknown word or style: font-size
Misplaced item: 25
Unknown word or style: bold
Unknown word or style: underline
Unknown word or style: chtit
Misplaced item: 0.0
Misplaced item: 255.100.100
Misplaced item: 90.90.90
Unknown word or style: rejoin

Misplaced item: ["14." " " "MAINTENANCE OF PORTABLE ALUMINUM LADDERS"]

Misplaced item: [my-scroll-panel/access/set-scroll-offset my-scroll-panel 
0x-1 * 699x15723 focus]
Misplaced item: 0x0
Unknown word or style: edge
Misplaced item: [color: black size: 2x2]
Unknown word or style: effect
Misplaced item: [merge luma -80]
Group: !RebGUI ... A lightweight alternative to VID [web-public]
Louis:
3-Mar-2005
Definitions of widget on the Web:


    A standardized on-screen representation of a control that may be 
    manipulated by the user. Scroll bars, buttons, and text boxes are 
    all examples of widgets.
    www.redhat.com/docs/glossary/


    A set of clickable, graphical element in a user interface. This includes 
    buttons, radios, checkboxes, and scroll bars. Widgets vary in appearance 
    and dimension from platform to platform.
    www.gerbilbox.com/newzilla/glossary.php


    n. 1. A meta-thing. Used to stand for a real object in didactic examples 
    (especially database tutorials). Legend has it that the original 
    widgets were holders for buggy whips. "But suppose the parts list 
    for a widget has 52 entries...." 2. [poss. evoking `window gadget'] 
    A user interface object in {X} graphical user interfaces.

    www.worldwideschool.org/library/books/tech/computers/TheHackersDictionaryofComputerJargon/chap55.html


    (n.) In a window system, a reusable user interface component such 
    as a button, scrollbar, control area, text edit area, and so on. 
    When an X Toolkit Intrinsics function creates a widget, it is returned 
    as an opaque data handle and assigned to a variable called a widget 
    identifier. See also OLIT.
    docs.sun.com/db/doc/805-4368/6j450e610


     A graphical user interface programming object (button, scrollbar, 
    radio button, etc.) for the X Window System. (Also, see X Window 
    System.)
    www.newtolinux.org.uk/glossary.shtml
Ashley:
9-Jun-2005
Fixed the problem (disappearing label text after a field scroll) 
that Colin identified. Just needed to change "para: default-para" 
to "para: make default-para []" for editable widgets (as the new 
edit feel changes "para/scroll" values).
Graham:
22-Aug-2005
** Script Error: Cannot use path on none! value
** Where: edit-text

** Near: if all [tmp/x < 0 tmp2/x < 0] [face/para/scroll/x: tmp2/x 
- tmp/x]
tmp3:
** Press enter to quit...

on tabbing out of an edit box.
Graham:
24-Aug-2005
If you type enough text to start text scrolling, this is what happens


>> display "" [ myfield: field 20 [show-text face now/time/precise 
print face/text] ] do-events
16:50:17.808
** Script Error: Cannot use path on none! value
** Where: edit-text

** Near: if all [tmp/x < 0 tmp2/x < 0] [face/para/scroll/x: tmp2/x 
- tmp/x]
tmp3:
Graham:
26-Aug-2005
Oh, and how do I scroll the text in the chatarea using the slider?
Graham:
28-Aug-2005
Page up, down, and cursor keys do not scroll text within an area.
Graham:
2-Sep-2005
display "" [ group-box 60x20 "Test" data [ a: field 40 [ show-focus 
f]] return group-box 60x20 "Test2" data
[ f: field 40 ]] do-events
** Script Error: Cannot use path on none! value
** Where: edit-text

** Near: if all [tmp/x < 0 tmp2/x < 0] [face/para/scroll/x: tmp2/x 
- tmp/x]
tmp3:


After typing a few times in the top field, and then hitting enter, 
the error above can occur.
Graham:
4-Sep-2005
display "" [ group-box 60x20 "Test" data [ a: field 40 [ show-focus 
f]] return group-box 60x20 "Test2" data
[ f: field 40 ]] do-events


type abcd in the top field, hit enter.  Type abc in the bottom field, 
and hit enter.  Then hilite all the chars in the top field, enter 
a single character, and hit enter.  

** Script Error: Cannot use path on none! value
** Where: edit-text

** Near: if all [tmp/x < 0 tmp2/x < 0] [face/para/scroll/x: tmp2/x 
- tmp/x]
tmp3:
>>

This is version 3.6
Volker:
10-Oct-2005
redraw: func [face act pos][

        if all [act = 'show face/text-y <> second size-text face] [
            face/text-y: second size-text face 

            face/pane/ratio: face/parent-face/size/y / face/text-y 

            unless face/pane/ratio < 1 [face/para/scroll/y: 0 edit/focus face]
        ]
    ]
Graham:
10-Oct-2005
** Script Error: Invalid argument: redraw
** Where: context
** Near: feel: make edit/feel [
    redraw: func [face act pos] [

        if all [act = 'show face/text-y <> second size-text face] [
            face/text-y: second size-text face

            face/pane/ratio: face/parent-face/size/y / face/text-y

            unless face/pane/ratio < 1 [face/para/scroll/y: 0 edit/focus face]
        ]
    ]
]
esc:
Pekr:
7-Dec-2005
- still - pop-up system non system friendly (not Rebgui issue, but 
rebol one's)

- I have some difficulcy with leds - If you would not provide me 
with text help, I would very hardly know, what those state means 
- I am not sure such style has place in standard pack ... or just 
- let it transparent for 'not-selected selection, green for 'on selection, 
red for 'off selection ...

- table - still you are able to scroll hilited row "under" the table 
style border - it should know it is at last displayed element and 
start scrolling, scrollers should reflect that. If there is no internal 
track of hilited row/cell, then it is not true grid system (I hope 
not)

- bug with text-list multi selection - there seem to be bug in math 
... press shift, hold it, hilite e.g. 6 rows. Still hold it, press 
some two rows below, it let's hilited only first two rows ...
Ashley:
26-Feb-2006
RebGUI goes Beta! With the fixing of some long running area / scroll 
/ slider bugs I've finally reached a stable enough release candidate 
for 0.4.0 Beta; so, from a REBOL/View console:

	do http://www.dobeash.com/get-rebgui.r
	do view-root/public/www.dobeash.com/RebGUI/tour.r


Also note that the demo directory includes a nifty new pie-chart 
widget demo (thanks Robert).


I've also separated the 0.3.x and 0.4.x issues into separate sections: 
http://www.dobeash.com/it/rebgui/issues.html#section-2.3

Changes in this release include:


 Scrolling fixed (all area scroll / slider problems should be fixed, 
 and a couple of minor field scrolling issues were also fixed)

 set-locale function to dynamically change locale files / dictionaries
	pie-chart widget added

 slider width reduced by 1/5 for area, table, text-list, drop-list, 
 edit-list (looks better)

 table column arrows made smaller and darkened, plus right-most arrow 
 moved to table boundary (more space for column heading text)


and an important one from 0.3.9 that I omitted to mention last release:


 drop-list / edit-list now size to the smaller of number of items 
 or available space in the bounding parent face (so no more lists 
 that disappear off the edge of a face / window)

Enjoy!
Ashley:
30-Mar-2006
line-list is the culprit. Replace the 'show-text and 'clear-text 
functions in %rebgui.r with the following:

show-text: make function! [
	"Sets a widget's text attribute."
	face [object!] "Widget"
	text [any-type!] "Text"
	/focus
][
	face/line-list: none
	insert clear face/text form text

 all [face/type = 'area face/para face/para/scroll: 0x0 face/pane/data: 
 0]
	either focus [ctx-rebgui/edit/focus face] [show face]
]

clear-text: make function! [
	"Clears a widget's text attribute."
	face [object!]
	/no-show "Don't show"
	/focus
][
	face/line-list: none
	clear face/text

 all [face/type = 'area face/para face/para/scroll: 0x0 face/pane/data: 
 0]
	unless no-show [
		either focus [ctx-rebgui/edit/focus face] [show face]
	]
]
Anton:
28-Apr-2006
Graham, this patch to the area/pane (slider) action makes things 
better:

				action:	make function! [face /local pos new] [

     ;	don't alter scroll if the last function to touch it was edit-text!!!
					unless parent-face/key-scroll? [

      parent-face/para/scroll/y: negate parent-face/text-y - parent-face/size/y 
      + 3 * data

						if system/view/caret [
							system/view/caret: 
								offset-to-caret parent-face 
									new: min max 
									(pos: caret-to-offset parent-face system/view/caret)

         0x0 ; <-- should add height of one line of text, to keep caret fully 
         visible

         parent-face/size - (face/size * 1x0) ; <- should subtract height 
         of one line of text
						

       ;print [parent-face/size pos new parent-face/para/scroll/y index? 
       system/view/caret]
						]

						show parent-face
					]
					parent-face/key-scroll?: false
				]


It also needs this patch to work correctly, near the top of rebgui-widgets.r:


 ; Unfortunately, offset-to-caret returns end of the string when offset 
 is between two lines, 

 ; which is only possible when indent/y > 0. This ought to be submitted 
 to rambo as a rebol/view bug.
	; I would not use indent until it is fixed.

 ; offset-to-caret needs to work correctly to allow the new area widget 
 functionality of keeping
	; the caret visible when scrolling. -Anton


 ;default-para-wrap: make default-para [origin: 2x0 indent: 0x2 wrap?: 
 true]

 default-para-wrap: make default-para [origin: 2x0 indent: 0x0 wrap?: 
 true]
Anton:
28-Apr-2006
Key-scroll? issue I mentioned above there is apparently fixed by 
adding this line to area/feel/redraw:


     ;	don't alter data if the last function to touch it was slider!!!
					if all [face/pane/ratio < 1 face/key-scroll?] [

      var: either view*/caret [-3 + second caret-to-offset face view*/caret] 
      [0]

      face/pane/data: either zero? face/para/scroll/y [0] [(var + negate 
      face/para/scroll/y) / (face/text-y - sizes/font-height - 2)]
						face/key-scroll?: false ; <-- added this line -Anton
					]
Graham:
17-May-2006
** Script Error: Cannot use path on none! value
** Where: edit-text

** Near: if caret/y < (edge/size/y + para/origin/y + para/indent/y) 
[scroll/y: round/to scroll/y - caret/y sizes/
font-height]
Pekr:
11-Dec-2006
heh, Bobik is demotivated to use Rebgui because 1) text-list scroll 
under the horizont 2) area does not auto-scroll, when you hilite 
text by mouse. It is interensting, how various ppl feel about various 
"details"
Ashley:
8-Apr-2007
Build 74 uploaded to SVN. Includes the following additions:

1) New action object used as follows:

	box "" red
		on-click		[
			print "click"

   system/view/focal-face: face	; required to pick up scroll events
			system/view/caret: face/text	; required to pick up key events
		]
		on-alt-click	[print "alt-click"]
		on-dbl-click	[print "dbl-click"]
		on-scroll		[print scroll]
		on-key			[print ["key" event/key]]
		on-over			[print "over"]
		on-away			[print "away"]
	;	on-focus		[print "focus"]
	;	on-unfocus		[print "unfocus"]

2) New layout keywords added as follows:

	text "Test" text-color blue
	text "Test" bold
	text "Test" italic
	text "Test" underline


3) New 'examine function added to provide detailed information about 
a widget:

	>> examine table

Also a number of fixes:

1) Multi-row Shift hilight selection fixed (pekr)
2) Dialog has parent option by default (Frank)
3) Keystrokes on a button no longer passed along (Graham)
4) request-password enhanced to allow following:

		request-password/check [if (length? text) < 6 ["Problem"]]

5) /scroll option removed from display

6) /min-length & /max-length refinements removed from request-password

7) /no-action option added to select-row function of table & text-list


WARNING: These changes are wide-reaching and have not been fully 
tested ... some things may have been broken. Full documentation in 
preparation.
Graham:
14-Apr-2007
and in a chat screen, you don't normally need to scroll the text 
in the reply area ..
Graham:
19-Apr-2007
An error has occurred.  If this occurred with an upgrade, please 
revert to the older version for the meantime, and report the error 
message as documented below.

make object! [
    code: 303
    type: 'script
    id: 'expect-arg
    arg1: 'clear
    arg2: 'series
    arg3: [series! port! bitset! none!]
    near: [clear f/text 
        all [f/type = 'area f/para/scroll: 0x0 f/pane/data: 0] 
        f/line-list:
    ]
    where: 'clear-text
]
Graham:
19-Apr-2007
>> display "" [ el: edit-list data [ "1" "2" ] button "Set" [ el/text: 
1 show el ] button "clear" [ clear-text el
]] do-events

** Script Error: clear expected series argument of type: series port 
bitset none
** Where: clear-text
** Near: clear f/text
all [f/type = 'area f/para/scroll: 0x0 f/pane/data: 0]
f/line-list:
Graham:
19-Apr-2007
well, not /insert .. perhaps /ins

set 'set-text make function! [
	"Set and show a widget's text attribute."
	face [object!] "Widget"
	text [any-type!] "Text"
	/ins
	/no-show "Don't show"
	/focus
][
	unless string? face/text [exit]
	either all [ ins face/caret ][
		insert skip head face/text face/caret form text
	][	
		insert clear face/text form text
	]
	all [
		face/para
		face/para/scroll: 0x0
		all [face/type = 'area face/pane/data: 0]
	]
	face/line-list: none
	unless no-show [either focus [set-focus face] [show face]]
]
Graham:
20-Apr-2007
Something like:

set 'set-text make function! [
	"Set and show a widget's text attribute."
	face [object!] "Widget"
	text [any-type!] "Text"
	/caret {insert at cursor position}
	/no-show "Don't show"
	/focus
][
	unless string? face/text [exit]
	insert either all [ caret face/caret ][
			at face/text face/caret 
	][	
		either caret [ tail face/text ][	clear face/text ] 
	] form text
	all [
		face/para
		face/para/scroll: 0x0
		all [face/type = 'area face/pane/data: 0]
	]
	face/line-list: none
	unless no-show [either focus [set-focus face] [show face]]
]
TimW:
20-May-2007
Is there a way to make the scroll automatically go down when adding 
text to an area?  I have an area I'm using as a status terminal window 
and I can't see the feedback until the task is done because the scroll 
stays at the top.
Anton:
20-May-2007
print mold svv/vid-styles/area/feel  ; <-- this shows use of EDIT-TEXT, 
which is in CTX-TEXT, so..

print mold make ctx-text  [view*: none] ; <-- the reference to system/view 
gives too much output, so we disable it for now.

; If you search that text for "scroll", you find yourself near the 
bottom of the EDIT-TEXT function body, looking at this:
Anton:
20-May-2007
if face: focal-face [
            if flag-face? face hide [
                unlight-text 
                insert/dup clear face/data "*" length? face/text 
                do swap-text
            ] 

            tmp: any [caret-to-offset face caret caret-to-offset face caret: 
            tail face/text] 
            tmp: tmp - (face-edge / 2) 
            tmp2: face/para/scroll 

            all [tmp/x < 0 tmp2/x < 0 face/para/scroll/x: tmp2/x - tmp/x] 

            all [tmp/y < 0 tmp2/y < 0 face/para/scroll/y: tmp2/y - tmp/y] 
            action: face-size - tmp - face/para/margin 

            if action/x < 5 [face/para/scroll/x: tmp2/x + action/x - 5] 

            if action/y < liney [face/para/scroll/y: tmp2/y + action/y - liney] 
            show face
        ]
Anton:
20-May-2007
Scrolling is achieved by modifying face/para/scroll, where FACE is 
your AREA face.

I am sure you can pick the parts you need from the above code, to 
create a nice little function which only appends text.
Note also the definition of LINEY, from further up in EDIT-TEXT: 
        textinfo face line-info 0 
        liney: line-info/size/y 
This depends on LINE-INFO, which is in system/view/line-info

So you will need to either bind your code to system/view and ctx-text, 
or refer to line-info and unlight-text using paths, eg:
	system/view/line-info
	ctx-text/unlight-text
TimW:
31-May-2007
Is there a way to make a horizontal scroll bar on a table?  Or maybe 
to make a text-list or area have the horizontal scroll bar?  It may 
be to use the slider widget, but documentation is a bit scarce.
Ashley:
31-May-2007
effects/radius: 0 for group-boxes?
 ... effects/radius is global. It is currently used by:

	group-box
	panel
	tab-panel
	tooltip

and can be set as follows:

	ctx-rebgui/effects/radius: 0

Is there a way to make a horizontal scroll bar on a table?

 No, nor with text-list or area. Same issue with tab-panel. This is 
 quite deliberate and you may wish to refer to my comments from 10th 
 March this year headed, "A word on my design philosophy, ...", to 
 see why. ;)
Ashley:
24-Dec-2007
Uploaded build#110.

1) Improved scroll-panel and tree widgets


2) Replaced request-dir with a simpler tree-based version (WARNING: 
it reads the entire tree from the path given so don't use it to browse 
a root directory)


3) Added a new heading widget (basically text at twice the font size)


4) Added prototype of new RebDOC app (still needs to be generalized, 
and the code / data that drives it still needs to be cleaned up a 
bit - but it shows the direction I'm heading with regards to "self-documenting" 
apps / code)


5) Removed a number of unmaintained widgets (due to growing incompatibilities)
Ashley:
26-Dec-2007
are we replacing the tab, or the panel?

 We're replacing the panel, which in this context is refereed to as 
 a tab. Same logic applies to the 'select-tab accessor.

Are we sure widgets should 

remember" their state?" ... with regards to the RHS of the display; 
it can be argued either way. If I want to look at the usage text 
of each widget then it's nice to be able to scroll to the bottom 
and then remember this state as I click on each new widget ... but 
then again, if I want to "start afresh" with each entry it'd be nice 
if the scroller reset. As discussed, I'll add this as an option.


re: Magic modes. In one of my apps I had "programmable" buttons that 
you could right-click to bring up a menu of what the button should 
say (it's text) and what it should do (it's functionality). Only 
a small number of these buttons existed and they were colored differently. 
This one simple feature saved a lot of screen real-estate, was easy 
to explain to end-users; and most importantly, was the "killer" feature 
for those using the app.
Ashley:
1-Jan-2008
get-values expects a grouping widget; so:

	scroll-panel data [field field]
	scroll-panel data [tab-panel data ...]

work. For scroll-panel with a single non-grouping widget use:

	s: scroll-panel data [field]
	button [print s/pane/1/text


A pain I know, but using scroll-panel for a single non-grouping widget 
would be pretty rare I'd think.
Graham:
4-Feb-2008
I would like to double click on the choices in the edit-list, but 
that then results in loss of the highlite on the selected word.

Also, I would like to see some way for the text to scroll following 
the highlite, and currently I have to move the slider manually.
JohanAR:
21-Mar-2008
I'm not 100% sure what Graham requests about the sliders, but it 
might be the same as a feature I wanted. I wrote alot of text to 
an area with a scroller, and I want to be able to remove text at 
the top and insert at the bottom - while keeping the horizontal scroller 
at the bottom (unless the user wants to scroll up ofcourse, in case 
the scroller should stay exactly where it is). In other words similar 
to a DOS prompt with some scrollback buffer.


Can't remeber exactly what problems I had with it, but it didn't 
work as intended :) Now I'm using a chat widget instead and it works 
pretty good. Not a bad feature to have though.
Graham:
21-Mar-2008
Johan, if you have a large amount of text, and the slider is set 
to the bottom, and then you set-text with a small amount of text, 
it doesn't show up until you physically scroll the slider up to the 
top.
Bobik:
26-Aug-2009
Hi Ashley, i would like ask you, are you thinking about auto-scroll 
in widget AREA, because of  i can not select text bigger than area 
size.  Cool example in VID has Didier Cadieu, see http://www.rebol.org/view-script.r?script=area-scroll-style.r&sid=ptn126rv
BudzinskiC:
16-Apr-2010
I need help! But that aside, how can I scroll programatically to 
a certain position in an area? I was able to scroll to the very end 
by doing this:


textarea/para/scroll/y: negate (textarea/text-y - textarea/size/y)
show textarea


But the scrollbar handle stays at the top when doing this. I haven't 
yet found out how I can access the scrollbar from the area which 
is probably what I will have to do to solve this, right?
BudzinskiC:
16-Apr-2010
Thanks a lot :) Before I do something completely wrong again... I 
also want to scroll to a certain line in the text area if possible. 
My approach now would be to see if I can somehow see how many lines 
of text are displayed in the text area, calculate the percentage 
of the line I want to scroll to based on this total number of lines, 
divide that by 100 and use it for a/pane/data. Right..?
BudzinskiC:
16-Apr-2010
This seems to work:

display "test" [
	a: area (mold ctx-rebgui/colors)
	button [
		scroll-to-line: 5
		
		line-height: 30
		total-lines: (second size-text a) / line-height
		percent: ((scroll-to-line - 1) / (total-lines / 100)) / 100
		a/pane/data: percent
		show a
	]
]


The height of a line is hardcoded though which means it stops working 
if the font size is changed. Is there a way to get the current line 
height?
BudzinskiC:
18-Apr-2010
Thanks Ashley. That only shows the height for the default font though. 
I am displaying three text areas with different font sizes, so I 
set the font size in the areas directly. I had to use an invisible 
text area now anyway though because I forgot that to be able to scroll 
to a certain line in the text area I have to find out in which line 
a certain word, to which I want to scroll, actually is :) So now 
I made a test text area for this and positioned the "real" text area 
on top of it so that the test text area is completely covered by 
it. I copy the text up till the word I want to scroll to into the 
test text area and then look at the text size of the test text area 
and use that information to scroll the "real" text area to this word. 
It isn't working correctly yet but it should so I guess I just made 
a stupid mistake somewhere, have to look at it again tomorrow.
Awi:
13-Jan-2011
REBOL []

do %rebgui.r
seat-layout: copy []

loop 16 [
	insert tail seat-layout compose/deep [panel 50 data []]
	for row 1 15 1 [
		foreach col [A B - D E] [

   insert tail last seat-layout compose/deep [button 7x5 blue (rejoin 
   [row col]) [alert face/text]]
		]
		insert tail last seat-layout [return]
	]
]

display "test scroll panel" compose/deep [
	calendar 
	scroll-panel 152x100 #HW data [after 4 (seat-layout)]
	calendar
]
do-events
Awi:
14-Jan-2011
REBOL []

do %rebgui.r
seat-layout: copy []

for slot 1 16 1[
	insert tail seat-layout compose/deep [panel 50 data []]
	for row 1 15 1 [
		foreach col [A B - D E] [

   insert tail last seat-layout compose/deep [button 7x5 blue (rejoin 
   [row col]) [display "test" [text "see me?"]]]
		]
		insert tail last seat-layout [return]
	]
]

display "test scroll panel" compose/deep [

 table options ["id" left .2 "name" right .8] data [1x2 "A to B" 3x4 
 "C to D" 5x5 "E to F"] return 
	calendar 
	scroll-panel 152x100 #HW data [after 4 (seat-layout)]
]
do-events
Awi:
15-Jan-2011
Here I found another bug with the text-list style. When your list 
is longer than the box (means you have to scroll), deleting the item 
at the bottom caused some calculation mismatch in redraw. This don't 
happen when you start deleting from the top. Here is the test case:
Awi:
15-Jan-2011
do %rebgui.r

display "test scroll panel" [
	tl-rute: text-list data [ "a"  "b"  "c"  "d"  "e"  "f"]
	button  red "-" [
		if tl-rute/selected [
			remove find tl-rute/data tl-rute/selected
			tl-rute/redraw
		]
	]
]
do-events
Group: Rebol School ... Rebol School [web-public]
Maxim:
9-Mar-2011
yes, you need to hack the event engine a little bit.   


As gregg says, you need to have a memory of the last move event to 
get its position  and store it (you can do this with an event-handler). 
 glayout and GLASS do this for handling scrollwheel events.


what I also do is find the top-level face which is under the mouse-cursor 
and fire off my own events from the scroll-wheel instead of relying 
on a text field.

again, you can trap the scroll-wheel events in the event handler.


if you want to have a ready-made solution, download glayout.r from 
rebol.org  and look at the hacked WAKE-EVENT function.


it already does all of this and wraps it up by adding new function 
you can add to your face/feel  object in order to handle scroll-wheels.
Group: Tech News ... Interesting technology [web-public]
Henrik:
3-Oct-2006
Mail can be good for ad hoc databases, but in my experience, keeping 
track of a conversation can be a bit of a nightmare if you are not 
careful, changing the subject line or something that will screw the 
thread up. This depends on how good the mail client is at threading. 
There is also a problem with certain mail clients not adhering to 
the Re: standard reply prefix for subjects.

Seeing how different people use mail clients very differently, it's 
hard to keep posts flowing in a readable way, if they continously 
decide that every mail needs a new subject, or the subject line is 
blank. This happens for people who are not accustomed to posting 
on mailing lists, where structure is very important. Unfortunately 
most customers that I deal with, do not use their mail clients efficiently, 
because they are unaware of the weaknesses of email. Email was designed 
in an era where sending text messages across phonelines were considered 
pretty high tech and was mostly used by technical people and only 
in select locations.


Just today I was looking for a mail inside an old thread, a response 
to a question I had asked a customer. I couldn't find it. It turned 
out that the customer apparently had never answered it, but I can't 
be sure whether I had accidentally deleted it or if the mail client 
had stowed it somewhere else. Mail just doesn't cut it anymore. It 
needs to be replaced with something much more rigid and with structure 
forced upon it by the clients. Significant protection from spam should 
be there by design, not by throwing advanced algorithms, money and 
CPU power at the problem.


This is why I like AltME. You have the instant messaging capability 
and I can still write long blurps like this one without loosing structure 
of an ongoing one-line conversations in the same thread (group in 
AltME). It'll end up in the right place. It's going to be very certain 
that you'll be able to read it a few seconds after I hit Send. It's 
logged and searchable, though it will scroll out of view quickly.
Group: !REBOL3-OLD1 ... [web-public]
Graham:
10-Oct-2007
Anyway, I would to see V3 create windows that can scroll easily with 
text and graphics as browser  windows do
Henrik:
28-Oct-2008
SCROLLER now has a tiny bit of intelligence: It will scroll the first 
face that responds to ON-SCROLL if one precedes it earlier in the 
layout code.

So:

view [text-list-box [1 2 3 4 5 6 7 8] scroller]


will automatically attach scroller to the text-list-box and scroll 
it.
Henrik:
28-Oct-2008
view [text-list-box [1 2 3 4 5 6 7 8]  text-list-box [1 2 3 4 5 6 
7 8] scroller]

will only scroll the last text-list-box.
Henrik:
6-Dec-2008
Ok, I'm building it of several parts. (This may change if I find 
some more clever way of doing it.) First there is a DATA-GRID, which 
is a TIGHT style that contains actors to generate a grid view and 
links to a block of data. DATA-GRID is a slave style in that you 
link it to a data block and then it will display what it can display 
of that block from a start index set in the style, so it works like 
a data window. TEXT-GRID is currently just a variant of DATA-GRID 
with different spacing between cells.


Next, we can move that start index around by attaching a scroller 
to the DATA-GRID, and set the DATA-GRID's ON-SCROLL actor to set 
a new index, based on the input from the scroller. The scroller will 
be set based on the size of the data block versus the size of the 
data grid. Presto, a functioning list view.

I will explain sorting, filtering and all that later.
amacleod:
5-Jan-2009
I'm having a memor issue too.

I have an app that uses a scroll panel that I fill with text and 
images (a "page"). Each time I change the panel data (the "page") 
the memory footprint increases. But If I reload a "page" that was 
previously displayed memory size  does not change.

I can see if the memory holding the "page" does not clear properly 
but how does it know that the "page" is already in memory?
I'm holding the composed data in a block - 
	page: copy [ composed page data ] 
and I clear it befrore rebuilding it - 
	page: copy [ ]
amacleod:
5-Jan-2009
I'm changing the content (text and images) of the page each time 
I "show" it in the scroll panel. And each time I "show" a new "page" 
memory use increases but if I re-"show" a page that was previously 
viewed memory use does not change significantly.
Group: !Cheyenne ... Discussions about the Cheyenne Web Server [web-public]
Graham:
16-Oct-2008
<script type="text/javascript" >
function tab_to_tab(e,el) {

    //A function to capture a tab keypress in a textarea and insert 4 
    spaces and NOT change focus.

    //9 is the tab key, except maybe it's 25 in Safari? oh well for them 
    ...
    if(e.keyCode==9){

        var oldscroll = el.scrollTop; //So the scroll won't move after a 
        tabbing

        e.returnValue=false;  //This doesn't seem to help anything, maybe 
        it helps for IE
        //Check if we're in a firefox deal
      	if (el.setSelectionRange) {
      	    var pos_to_leave_caret=el.selectionStart+4;
      	    //Put in the tab

          el.value = el.value.substring(0,el.selectionStart) + '    ' + el.value.substring(el.selectionEnd,el.value.length);

            //There's no easy way to have the focus stay in the textarea, below 
            seems to work though

            setTimeout("var t=document.getElementById('code1'); t.focus(); t.setSelectionRange(" 
            + pos_to_leave_caret + ", " + pos_to_leave_caret + ");", 0);
      	}
      	//Handle IE
      	else {
      		// IE code, pretty simple really
      		document.selection.createRange().text='    ';
      	}
        el.scrollTop = oldscroll; //put back the scroll
    }
}
</script>
Group: !REBOL3 Extensions ... REBOL 3 Extensions discussions [web-public]
Maxim:
16-Jul-2010
true, but objects can be nested. and a single small object, like 
in the above, may actually represent MANY draw commands.
 

for example... a single block of text strings... may actually represent 
all the items of a text list.  parsing that list to fit things within 
bounds. 

re-creating the whole AGG block as you scroll the list, forces you 
to possibly generate a few hundred draw items in a block.


but you have to build that block using intepreted code, which only 
ends up being an intermediate in order to pass the visuals to the 
rendering.


with an object, constructing that visual can all be handled on the 
native side and will save a lot of work on the interpreter and the 
GC.
Group: !REBOL3 Schemes ... Implementors guide [web-public]
Graham:
19-Feb-2010
I wonder if it's there to force the text to scroll to that point 
...
Graham:
19-Feb-2010
The issue in updating an area is to show the new text ... which may 
be out of sight unless you somehow force the area to scroll down 
to the new text
Group: !REBOL3 GUI ... [web-public]
Ashley:
28-Jan-2010
Reposting from R3 chat (which seems a bit quiet lately).


I've been looking at the rich text gob! functionality and it seems 
the following dialect commands are supported:

	anti-alias logic!
	bold [off]
	italic [off]
	underline [off]
	size integer!
	left|center|right
	drop integer!
	font object!
	para object!
	caret object!
	scroll pair!
	string!


Are there any I've missed? Any doco on this yet? I havn't figured 
out how to use drop or caret yet. Anyone have any working examples 
for these?


A design question: is there any reason for retaining font and para 
support given that we could move the few remaining unsupported words 
out of those objects and into the dialect itself? (e.g. have the 
dialect directly support font names and valign words).


Also, it would be nice if we had control over the default font name, 
size and alignments [at the very least]. Perhaps a system/view/text 
object?
Pekr:
5-Oct-2010
Area style report:


1) hilite some few chars, then you click elsewhere in the text, or 
just move the caret using arrows - the text stays hilited, whereas 
default OS behaviour is, that the hilite is discarded. The question 
is, if we are targeting for REBOL specific behaviour, e.g. allowing 
to move caret, and have multi-hilte areas? I think not.


2) hilite autoscroll works chaotically. Sometimes it scrolls the 
area, sometime it does not. Dragging the mouse outside the window 
does not work at all.


3) scroll by mouse-wheel. When I reach the "bottom" of the area, 
I loose my focus, and scrolling back up does not work


4) moving up/down by arrow. It seems that in OS native widget (Notepad), 
the caret position is counted by the follow-the-leftmost-tex-length 
rule. So if I e.g. go via an empty line, caret should stay at the 
beginning of line for all other rows.

5) cut and paste into Notepad discards newlines


6) cut and paste from Notepad inserts text in hilited form - random 
behaviour here, ot it needs more observation ...


7) hilited text should be deleled by hitting delete, backspace, or 
by typing any character

8) when hiliting the text by mouse, scroller gets reset to 100%

Is that enough bug-reporting for the starter? :-)
Rebolek:
6-Oct-2010
The problem with original scroller is, that is was 'too smart', it 
was scrolling area it was attached too. That may seem like a good 
idea at first unless you don't need the scroller to do something 
different like instead of setting area's offset, you need to change 
e.g. text's scroll. So right now the scroller just returns value 
and the style needs to handle that value by itself.
Pekr:
6-Oct-2010
Change text's scroll? That would be the work for corresponding on-scroll 
handler for particular handler, no?
Pekr:
5-Mar-2011
Following few things:


- why is "custom" include needed? We should either user R3 native 
facilities, or include an include as a standard into R3 :-) (this 
is no real question, just a remark that if we find it usefull, then 
why notto make it part of R3?)

- RMA does not work with CureCode tickets. It would be good to either 
dismiss/close or resolve them? E.g. I find renaming of do-style and 
do-face to do-action, do-reaction a good tip to implement


- we should resolve the size of buttons vs scroller vs tabs. In Carl's 
GUI, button is 28 pixels tall, and it feels OK. Our's here is 22, 
I have no preference here, but could be those 28 pixels. Scroller 
is only 16pix - not acceptable imo. It should be of the size of the 
progress. Tabs are proportionally too tall.

- tabs should have line removed for actual tab. I suspect it might 
be more difficult to draw the container then.

- there seems to be someone at RMA liking Old aqua interface of MacOS. 
Tabs, buttons and scrollers are a good example ... of how to not 
do visuals anymore :-)

- area - enter few lines, go to bottom, and try to hilite the text 
by keyboard (shift plus arrow-up). It always hilites only actual 
line

- info areas, labes, etc., should prohibit display of caret, maybe 
allow hilighting, but allowing to have caret in "disabled" area is 
not looking nice

- text-table buttons are Excel filter inspired, but looking strange 
- some more thoughts needed
- select-an-option does not allow keyboard navigation

- text-list does not scroll, when navigated by keyboard, ditto text-table

- tabbing feels strange for text table. I alway said, that we need 
nested tabbing. I can imagine tab stopping on table, but next tab 
moving away, not actually going into tabbing in terms of the hilited 
widget. Enter should enter the more complex style, escape move away. 
That is not typical also at OS level, but then - everybody has it 
wrong :-)

- between the text-list and text-table, I have to press tab three 
times -visually I am not sure, "where" hilite disappears

- is text-table a compound style? What sense does it have to have 
buttons hilighted, not being able to enter the action? Why are not 
arrows tabbable? Table headers cells should be one style, not two.

- text-table is the weakest "grid" we ever had. Comparing to Cyphre's 
style pack, and rebgui grid. This is like 5% of functionality, not 
thought out style, useless for any serious data. I want to see the 
display of infiinte amount of data, proper caching.

- tab should be tabbable, ctrl-tab allowed to switch between the 
tabs  


I find the styles/gui inconsistent. There should be someone defining 
the styles, their behaviour to keyboard navigation, tabbing, etc. 
So far it seems like style being put together with no deeper thought 
about the end result of the whole GUI.
Group: !REBOL3 Host Kit ... [web-public]
Pekr:
20-Oct-2010
Cyphre - I am not sure if we should accept CSS document model here, 
as users/designers are used to it? I tried to search for some typography 
vocabulary, but there is not much in it:

http://www.proximasoftware.com/fontexpert/terms/


Then I also looked into MS Word (well, not the best DTP option, I 
know :-), but I am somehow satisfied, how paragraph styling is done 
in it, and I find it pretty much flexible. So few of my notes:

PAGE:
--------
- text-gob - let's say it equals to page


- margin should allow to set 4 sides, as is with CSS and even DTP 
systems. DTP system talk about margin as about the space to the edge 
of the paper. I don't know, how such terms are used in conjunction 
to R3 GUI, but we should somehow find-out, how to not be confusing. 
But - having just a single marign is not imo sufficient.


- origin should replace scroll, and it should mean offset. But looking 
into VID2, origin just did what you propose - but I don't like it, 
as it required us to introduce offset to VID2.

PARA:


- indent - e.g. MS Word defines: indent-left, indent-right (kind 
of creates margins/padding, if you relate to CSS terms), then they 
have indent-special - first-line | "pre-indent" (-first-line,not 
much usefull). It also has check-box for "mirror setting", which 
changes indent-left to inner, and indent-right to outer (dunno what 
it is good for)


- spacing - top-space | bottom-space - but here, it is not inner 
space in paragraph, it is more of an indentation between paragraphs. 
In other words - I can imagine calling it even padding (as we are 
used from VID2, we used space there for the auto-spacing). It allows 
you to set, that it will not add space in between two paragraphs 
of the same style. It also allows you to set spacing for rows - either 
by float, or by multiples, 1,5 rows, double, the-least-possible (pixels), 
exactly (pixels)


- paging - some stuff to set in regards to paragraph and paging, 
as linking of paragraphs, linking of lines

- runaround settings (dunno if correct english term)
Cyphre:
21-Oct-2010
Pekr, thanks for your useful feedback, some reactions:

PAGE

margin should allow to set 4 sides

 - this is done by using ORIGIN and MARGIN pair!s in the proposal, 
 I agree, we can use MARGIN with two pairs instead of that

origin should replace scroll
 - ok, makes sense if we accept the point above

PARA


indent - INDENT should define rectangular space at the beginning 
of the paragraph, the left right orientation would be chosen according 
to the horizontal align settings in each  paragraph. The value for 
indent could be pair! (to define the space in both ways) or number! 
to define just the horizontal indentation for the first paragraph 
line only.


spacing - here I'd use SPACING [pair!] for additional space between 
chars (X axis) and lines (Y axis). For space around paragraph (top, 
left, bottom, right) I would use PADDING.


paging - IMO linking of text between gobs at the C level would bring 
us lot of complexity. I still think we should provide functionality 
that can be useful at REBOL script level to handle the linkage.


runaround - this needs to be well thought so it is flexible enough 
once we allow to use embedded gobs in the text flow


alignment - I'd leave it as in the current proposal for now. Which 
means horizontal align can be set per paragraph vertical alignment 
per 'page'(=GOB)


I'll be updating the current document soon to reflect all the changes 
from yours and other useful suggestions. I'll post here once new 
version is online.