• 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
r4wp4
r3wp164
total:168

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

world-name: r4wp

Group: Rebol School ... REBOL School [web-public]
caelum:
22-Apr-2012
Is it possible to change the background color of the view led? Or 
are the only states available 'true' and 'false' which are green 
and red? I want different background colors for 'true' and 'false' 
states.

view center-face layout [
	across
	l1: led
	label "State" state: field

	btn "Change led state" [
		either l1/data [
			l1/data: false
			state/text: "False"
		][
			l1/data: true
			l1/data: true
			state/text: "True"
		]
		show [l1 state]
	]
]
Endo:
10-May-2012
I wrote another simple example as a one-liner, not useful in a real-world 
app. but gives an idea:


view f: layout/size [btn "add" [append f/pane layout/tight/offset 
[backcolor random white btn random "abcdef"] 50x50 + random 300x300 
show f]] 400x400
Endo:
10-May-2012
It actually adds new faces to the main face's pane, not the new styles. 
So, not a useful example. 
;no need to backcolor.. shorter:


view f: layout/size [btn "add" [append f/pane layout/tight/offset 
[btn random "abcdef"] 50x50 + random 300x300 show f]] 400x400
ChristianE:
4-Jul-2012
get-radio-buttons: does [
    reduce [
        get-face option-1
        get-face option-2
        get-face option-3
    ]
]

reset-radio-buttons: does [
    clear-face option-1
    clear-face option-2
    clear-face option-3
]

view layout [

    option-1: radio-line "Option 1" of 'options [probe get-radio-buttons]

    option-2: radio-line "Option 2" of 'options [probe get-radio-buttons]

    option-3: radio-line "Option 3" of 'options [probe get-radio-buttons]

    btn "reset radios" [reset-radio-buttons]
]

world-name: r3wp

Group: Ann-Reply ... Reply to Announce group [web-public]
ChristianE:
12-Jun-2005
It's a FIELD with a BTN in it's pane.
Anton:
1-Feb-2007
Ok, TOOLBAR is based on VID-FACE, so let's first check if it has 
a words dialect.
	>> print mold svv/vid-styles/face/words
	none
Good, so we can set our own without breaking anything.
	toolbar: FACE with [
		; define DATA function in the style-specific dialect

  words: compose [data (func [new args][new/data: args/2 next args])]
	]

All this does is allow a slightly easier spec. Your example from 
the blog:
	view layout [button-bar with [data: [ok-btn cancel-btn]]] 
can now be:
	view layout [button-bar data:[ok-btn cancel-btn]]

Ok, it doesn't save you much in this one example, but over time, 
it will.
Anton:
1-Feb-2007
Sorry, correcting that last example:
can now be:
	view layout [ button-bar data [ok-btn cancel-btn] ]
Group: RAMBO ... The REBOL bug and enhancement database [web-public]
Anton:
21-Mar-2005
lay: layout [btn "start" [lay/rate: 1 show lay] btn "stop" [lay/rate: 
none show lay]] lay/feel: make lay/feel [detect: func [face event][if 
event/type = 'time [print ['tick now/precise lay/rate]] event]] view 
lay
p: open http://www.rebol.com
close p
view lay
Anton:
24-May-2005
view layout [btn "hide" [hide f] btn "show" [show f] f: box red 0:0:1 
feel [engage: func [face action event][if action = 'time [print now/time]]]]
Anton:
22-Dec-2005
view layout [
	fld: field "hello" [?? value]
	btn "change" [set-face fld "changed"]
]
Anton:
26-Nov-2006
I don't really like that hover state anyway. In my style-gallery.r 
I'm aiming to use a similar highlight to indicate the focused state 
of the btn or tog.
Group: Core ... Discuss core issues [web-public]
Ashley:
24-May-2006
Here's a different approach to get the result I'm after:

cast: make function! [
	block [block!] "Block to cast"
	words [block!] "Words to convert into literal words"
	/local blk word
	"Casts nominated words within a block into literal words."
] [
	blk: copy []
	repeat i length? block [

  insert/only tail blk either find words pick block i [to lit-word! 
  pick block i] [pick block i]
	]
	blk
]

>> cast [area red button green 'btn blue] [area button]
== ['area red 'button green 'btn blue]
>> reduce cast [area red button green 'btn blue] [area button]
== [area 255.0.0 button 0.255.0 btn 0.0.255]
BrianH:
24-May-2006
>> reduce/only [area red button green 'btn blue] [area button]
== [area 255.0.0 button 0.255.0 'btn 0.0.255]
Group: View ... discuss view related issues [web-public]
Chris:
2-Jan-2005
enable-fields: func [pane][

    foreach face pane [if face/style = 'field [face/feel: ctx-text/edit]]
]
disable-fields: func [pane][
    unfocus
    foreach face pane [if face/style = 'field [face/feel: none]]
]
view lay: layout [
    field field field guide
    btn "Enable" [enable-fields lay/pane] return
    btn "Disable" [disable-fields lay/pane]
]
Terry:
16-Jan-2005
Is there someway to do this.. 

X: [btn: "test" [print "test"]]

view layout [ X ]
Sunanda:
16-Jan-2005
View layout X should work
(You probably don't want the colon on btn)
Terry:
16-Jan-2005
>> x: [btn "quit"[]]
== [btn "quit" []]
>> view layout [x]
Unknown word or style: x
>>
Sunanda:
16-Jan-2005
I tend to dio something like:
 x: copy []
append x 'btn append x "quit"
Compose is useful here too for more complex layout building.
Graham:
16-Jan-2005
>> x: [ btn "quit" [] ]
== [btn "quit" []]
>> view layout do [ x ]
Terry:
16-Jan-2005
this works

>> x: [quit]
== [quit]
>> view layout [btn x]
Chris:
16-Jan-2005
; You could set up a function or two to simplify this code:
my-styles: []
append my-styles stylize [x: btn "Quit" [quit]]
append my-styles stylize [y: btn "Print" [print 'foo]]
view layout [styles my-styles x y]
Chris:
16-Jan-2005
; For example -- to accumulate styles:
add-styles: func ['val spec /new /local blk][
   blk: [] if new [clear blk]
   append blk stylize head insert spec to-set-word val
]
; Usage:
my-styles: add-styles x [btn "Quit" [quit]]
Chris:
21-Jan-2005
; For example -- to accumulate styles:
add-styles: func ['val spec /new /local blk][
   blk: [] if new [clear blk]
   stylize/styles head insert spec to-set-word val blk
]
; Usage:
my-styles: add-styles x [btn "Quit" [quit]]
james_nak:
2-Feb-2005
You know the "btn" style? How do you adapt that to say, a toggle 
button?
Allen:
2-Feb-2005
view layout [btn "hi" "ho" with [flags: [toggle]] feel (get in get-style 
'toggle 'feel)]
Allen:
2-Feb-2005
james: that's a just a starting point to show that applying the toggle 
feel to the btn gives you the desired effect. I'd probably stylize 
in real usage.
Allen:
2-Feb-2005
same again with an action block

view layout [btn "hello" "goodbye" [print face/text] with [flags: 
[toggle]] feel (get in get-style 'toggle 'feel)]
PhilB:
10-Feb-2005
Another thing ..... running on WinXP under view from 1.2.5 & upwards 
....
view/options layout [btn "Test"] [resize]

.... gives me a window that is only partly filled in with the default 
background color?
DideC:
11-Feb-2005
lay: layout [btn "Test"]
print lay/size
view/new lay
print lay/size
do-events
DideC:
11-Feb-2005
lay: layout [btn "Test"]
print lay/size
view/new/options lay [resize]
print lay/size
do-events
Chris:
23-Feb-2005
http://www.ross-gill.com/r/btn-style-old.r-- this is an earlier 
version of my xp-themed btn style.
Brock:
4-Mar-2005
rebol[]


last-sgrp: copy ""		;global used to keep track of last selected button 
in sgrp window

reset-toggles: does [

 t1/state: t2/state: t3/state: t4/state: t5/state: t6/state: t7/state: 
 t8/state: false
]

two-digits: func [num][
	either 10 > num [num: join "0" num][num]
]


get-report-date: function [/delim][report-day day rsd today s e day-diff][
	report-day: 6			; 6 = Saturday, start day of report
	today: now/weekday
	day-diff: report-day - now/weekday

 rsd: now + day-diff		;rsd = report start date		;'difference function 
 used to do date math
	either delim [

  s: join rsd/year ["/" two-digits rsd/month "/" two-digits rsd/day]
	][
		s: join rsd/year [two-digits rsd/month two-digits rsd/day]
	
	]
	e: rsd + 6
	either delim [
		e: join e/year ["/" two-digits e/month "/" two-digits e/day]
	][
		e: join e/year [two-digits e/month two-digits e/day]
	]
	report/text: join s [" - " e]
	show report
]

clear-entry: does [
	probe t1/text probe t2/text probe t3/text probe t4/text
	print "-------"

    clear-fields bx1			;;;;;;;;;;;; Error of disappearing toggle values 
    starts here
	probe t1/text probe t2/text probe t3/text probe t4/text
	print "======="
    ;clear-fields bx2			;;;;;;;;;;;;
    ;create-dt/text: form now
    ;update-dt/text: form now
    unfocus
    show dex
]

new-ticket: does [
    ;store-entry			;stores existing entry
    clear-entry			;clears fields for new entry
    if last-sgrp <> "" [application/text: last-sgrp]
    environment/text: copy "prod"
    show [application environment]
    focus application
]

dex-pane1: layout [
	across
	label "Support Group:"	application: field return
	label "Environment:" 	environment: field return
	label "Report Dates:"	report: field return
	btn "New Ticket" [new-ticket]
	pad 20 btn "Reset Toggles" [reset-toggles]
]

dex-pane2: layout [
	across
	label "Search Criteria:"

 t1: tog "o79" [write clipboard:// join "se sa**/" [last-sgrp: t1/text 
 "ca datp/" get-report-date/delim]]

 t2: tog "p23" [write clipboard:// join "se sa**/" [last-sgrp: t2/text 
 "ca datp/" get-report-date/delim]]

 t3: tog "o88" [write clipboard:// join "se sa**/" [last-sgrp: t3/text 
 "ca datp/" get-report-date/delim]]

 t4: tog "p11" [write clipboard:// join "se sa**/" [last-sgrp: t4/text 
 "ca datp/" get-report-date/delim]]
]

dex: layout[
	bx1: box dex-pane1/size
    bx2: box dex-pane2/size
]

bx1/pane: dex-pane1/pane
bx2/pane: dex-pane2/pane

view dex
Anton:
27-May-2005
LAYOUT sets face/var to be the name of the set-word, eg.    
	layout [ my-btn: btn ]
now 
	my-btn/var == 'my-btn
so you could use face/var, or perhaps face/user-data is better.
Ashley:
17-Jun-2005
The following used to work with View 1.2:


 view a: layout [btn 200x200 [view/new/options layout [btn 100x100] 
 reduce ['parent a]]]

but no longer works under 1.3. A bug?
Pekr:
23-Jun-2005
thanks a lot, Anton ... I also wonder about following I have two 
layouts, I have small search dialog, then I have grid displaying 
the result. I use button action block, when I call btn "search" [view 
lay2 focus f] - and I wonder - how is that the focus f part is executed? 
I am glad it works, just don't understand it, I thought that by view 
lay2 events will not allow processing focus f ...
Anton:
23-Jun-2005
view layout [btn "search" [view/new center-face layout [h1 "results..." 
f: field] focus f]]
Anton:
23-Jun-2005
view layout [btn "search" [view center-face layout [h1 "results..." 
f: field do [focus f]]]]
Pekr:
23-Jun-2005
lay1: layout [f: field [view lay2] btn "Quit" [quit]]
lay2: layout [text "just a try" btn "Return" [view lay1 focus f]]

view lay1
Volker:
23-Jun-2005
lay1: layout [f: field [
		probe "Dirty!"
		;view lay2
	] btn "Quit" [probe "Bye?"]]
lay2: layout [text "just a try" btn "Return" [view lay1 focus f]]
view lay1
Pekr:
24-Jun-2005
I have found very shortened example - simply the case, when you redefine 
layout several times - maybe it is wrong aproach, but because of 
grid I always called layout once again, to fill-in list value by 
data:


view lay1: center-face layout [btn "lay2" [view/new lay2: layout 
[btn "Return" [unview/only lay2]]] btn "close" [unview]]


now run above line, press lay2 button, go back to first screen, press 
lay2 button. It gets re-rendered. Try to press "Return" button on 
lay2 - it does not work anymore ...
Pekr:
24-Jun-2005
Graham - and besides that - we don't know the plan, do we? It is 
difficult to work/cooperate, as RT choosed the way when design is 
done by few ppl. It is good on one hand, as work is being finally 
done and we have got 1.3 out fast enough, but no docs follow, no 
plans follow. I e.g. asked someone from RT's extended team describe 
proper behavior of Installer, to actually test what is desired and 
what is not. But I can imagine docs are always lower priority, it 
is simply natural. But - I would really like to know, what goes for 
VID 1.4 or 1.3.x, whatever - only styles additions? What will happen 
to focus system, how will accessors be utilised, the same for doc 
subobject, what happens to VID in general?  - btn uses bitmap, but 
we've got powerfull AGG inside. Also - how will effects be merged 
with draw? We want to keep compatibility on one hand, but surely 
we don't want to have powerfull gradients withing draw, and old-ones 
within effect block ... So - don't ask me - I would expect some developers 
oriented document, short description of what and how is gonna be 
solved. Don't forget that it seems text mark-up is gonna be introduced 
- so - many changes, in hundreds of possible ways - so I will not 
propose conrete solution, if I know nothing about more general plan 
...
Izkata:
1-Jul-2005
;umm am I using Toggle wrong or is there a glitch in it?  This is 
View 1.3.1..


view layout [Tog1: toggle {First} Tog2: toggle {Second} btn {Pop} 
[Tog1/Data: Tog2/Data: false show [Tog1 Tog2]]]
Anton:
13-Jul-2005
view layout [
	pic: image
	b: box 100x100 sky with [data: 1] effect [draw []] feel [
		redraw: func [face action position][
			?? action
			if action = 'draw [
				insert clear face/effect/draw compose [
					fill-pen navy
					box 10x0 (as-pair 30 face/size/y * face/data * 0.01)
				]
				pic/image: to-image face
				;show pic ; causes a stack overflow
			]
		]
	]

 btn "change" [print "change" b/text: form b/data: random 100 show 
 b show pic]
]
Anton:
14-Jul-2005
view layout [
		pic: image

  b: box 100x100 sky with [data: 1 old-data: none doing-action?: none] 
  effect [draw []] feel [
			redraw: func [face action position][
				if all [
					action = 'draw 
					not face/doing-action?
					face/data <> face/old-data
				][
					insert clear face/effect/draw compose [
						fill-pen navy
						box 10x0 (as-pair 30 face/size/y * face/data * 0.01)
					]
					face/doing-action?: yes
					face/action face face/data ; action may cause recursion
					face/doing-action?: no
					face/old-data: face/data
				]
			]
		][
			; the action block
			show face
			pic/image: to-image face
			show pic

		]

  btn "change" [print "change" b/text: form b/data: random 100 show 
  b show pic]
	]
DideC:
3-Aug-2005
view layout [
	btn "Press me" [
		show-popup layout [btn "Close" [hide-popup]]
	]
]
Anton:
5-Aug-2005
view center-face layout [
	size 600x400
	list-face: face with [
		size: 500x300
		color: 170.165.160
		init: []
		data: ["hello" "there" "Robert"]
		spacing: 1x1
		ioffset: 0x0
		subface: make face [size: 100x24 effect: [merge luma 20]]
		pane: func [face id /local index][
			if pair? id [

    return 1 + first id - ioffset / any [all [subface subface/size + 
    spacing] 1] ; convert offset to row number
			]
			; id is subface ("row") number (an integer)

   ; update subface to the correct offset, call subfunc for each pane 
   of subface
			if subface [

    subface/offset: subface/old-offset: id - 1 * (subface/size + spacing) 
    * 1x0 + ioffset ; spread horiontally into columns

				if subface/offset/x > size/x [return none]


    if subface/show?: all [data id <= length? data][ ; <- this will need 
    to be improved when scrolling added

					index: 0
					if object? subface [
						subfunc subface id index: index + 1
					]

					subface ; return subface so it is shown by the view engine
				]
			]
		]

  subfunc: func [face [object!] id [integer!] "row" index [integer!] 
  "column" /local val][
			;face/text: ""
			;face/data: none
			if all [
				data 
				val: data/:id ; "row"
			][
				face/text: val ; "column"
			]
		]
	]
	btn "change data" [
		list-face/data: random list-face/data
		show list-face
	]
	btn "change x offsets" [
		list-face/spacing: random 40x0
		show list-face
	]
]
Graham:
13-Aug-2005
I previously used this for buttons with images :


view layout [ button "Reply" 60 font [align: 'right] myimage effect
[] ]

but this doesn't work for btn

view layout [ btn "Reply" 60 font [align: 'right] myimage effect
[] ]
Chris:
14-Aug-2005
view layout [btn "Reply" 60 effect [extend draw [image 5x5 myimage]] 
para [origin: 20x2]]
Pekr:
15-Aug-2005
view/options layout [backeffect compose [gradient 1x1] btn "Quit" 
[quit]] [resize]
Anton:
30-Aug-2005
Yes, they use an image and the EXTEND effect, indeed:
	print mold svv/vid-styles/btn/init
	? .png
	layout [b: btn "hello"]  b/effect
Henrik:
30-Aug-2005
REBOL [
  title: "Multi-File Search"
  author: "Henrik Mikael Kristensen"
]

search-function: func [/local files results] [
  results: copy []
  status/color: red
  show status
  nof-files: length? files: read to-file get-face search-dir
  forall files [
    if not dir? first files [
      data: read/lines first files
      status/text: join "Searching: " first files
      set-face status-progress divide index? files nof-files  
      show [status status-progress]
      forall data [
        if found? find/any first data get-face search-string [

          insert tail results reduce [first files index? data first data]
        ]
      ]
    ]
  ]
  status/color: gray
  results-list/data: results
  status/text: reform ["Results:" length? results "found"]
  show [results-list status]
]

main: layout [
  style header button 100x20 gray edge [size: 1x1]
  backdrop effect [gradient 0x1 200.200.200 180.180.180]
  across space 2 origin 8

  label white gray 300x20 "Search Multiple Files" font [align: 'center 
  size: 14] return
  search-string: field (as-pair 228 22) btn 70 "Search" [
    if not empty? search-string/text [search-function]
  ] return

  search-dir: field (as-pair 228 22) btn 70 "Directory..." [set-face 
  search-dir request-dir] return

  status: label white gray 300x20 "Results" font [align: 'center size: 
  14] return
  space 0x0

  header "File" header 50 "Line" header 132 "Text" box gray 18x20 return
  results-list: text-list 300x200 data [] [print "test"] return
  status-progress: progress gray white 300x10
]

set-face search-dir %.

inform center-face main
Izkata:
16-Sep-2005
view center-face layout compose [
   across origin 0x0 space 0x0 backdrop black
   style btn btn gray black
   btn {Close} [quit]
   btn {Send} []

   btn {Add Attachment} [append Attachments/text join mold request-file 
   newline show Attachments]
   return

   Attachments: area 300x100 do [Attachments/feel: make Attachments/feel 
   [engage: none]]
   return
   txt 100 {To:}
   To: field 200 {[Izkata-:-GMail-:-com]}
]
Graham:
22-Sep-2005
view a: layout [btn 200x200 [view/new/options layout [btn 100x100] 
reduce ['parent a]]]
Anton:
19-Oct-2005
Here is SHELL-LIST showing the VID styles BUTTON BTN TOGGLE and TOG, 
iterated without modification of them:
Anton:
9-Jan-2006
view layout [f: field "hello" btn "focus" [system/view/focal-face: 
f system/view/caret: tail f/text show f]]
Pekr:
3-Mar-2006
a bug? view layout [ch: choice 100 "a" "b" "c"  btn "zmen" [set-face 
ch "c" show ch]]
Henrik:
8-Mar-2006
I'm testing a tab button group with BTN look. What do you think? 
http://www.hmkdesign.dk/tabview.png
Henrik:
8-Mar-2006
I like the BTN style, but it's underused in VID for other applications, 
such as a tab button group
ChristianE:
13-Mar-2006
Small, yet very nice! Clear and cool, reminds me on e.g. the buttons 
of my old tape deck. I think you've already said it before: the BTN 
style's look is nice, but it's way too under-represented in VID, 
making typical layouts look inconsistend. This one helps.
Volker:
18-Jun-2006
probe first system/view 
probe get in system/view/event-port 'awake 
make system/view [source wake-event] 
system/view/wake-event: func [port /local event no-btn] bind [
    event: pick port 1 
print remold [event/type event/offset event/key] 
    if none? event [

        if debug [print "Event port awoke, but no event was present."] 
        return false
    ] 
    either pop-face [

        if in pop-face/feel 'pop-detect [event: pop-face/feel/pop-detect 
        pop 
            -face event
        ] 
        do event 
        found? all [
            pop-face <> pick pop-list length? pop-list 
            (pop-face: pick pop-list length? pop-list true)
        ]
    ] [
        do event 
        empty? screen-face/pane
    ]
] system/view 
echo on 
print "con" 
view layout [button "test" [probe "test"]]
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public]
Alberto:
9-Jun-2005
view layout	[
    across
    lbl "field 1" f1: field return
    lbl "field 2" f2: field return
    btn "hide f2" [hide f2]
]
Bobik:
5-Oct-2005
I can not understand behaviour of my example:
If i have a script1.r:
view layout [ ...
  btn "script2" [
    do %script2.r      
    print 123
  ]
]
... and sript2.r has: view layout [.....]
I expected that <print 123> will not execute because 
script2 has view layout... (no view/new layout [...])
Pekr:
6-Oct-2005
it does not seem to work:

view layout [btn "So what?" [inform layout [text "So what?"]]]
Henrik:
13-Jan-2008
you can also use it like this:


view layout [button "hello" here: guide button "test" at here btn 
"boo!"]
Maxim:
16-May-2009
ex: 

layout [
	my-btn: btn "ok"
]

probe my-btn
todun:
8-Oct-2011
x: btn "B" [
       swap SOME_LIST at SOME_LIST 6
]
Group: Make-doc ... moving forward [web-public]
Robert:
21-Jan-2005
update: I just extended make-doc-pro to support forms. Looks like 
this:

Test of Form Dialect in make-doc-pro

=toc

=options debug

===Introduction
This file test the form generation dialect.

\form test.cgi
	cgi-bin http://localhost/cgi-bin/

	; same-width with fields & buttons
	same-width left [
		field "Name1"
		field "Name12" 10
		field "Name123" 10 20
		field "Name"
		radio "R1" [Robby Linna Bunny Blacky]

		btn-enter "Abschicken"
		btn-cancel "Abbrechen"
	]

/form
shadwolf:
28-Jan-2005
Graham her you get the patch for this proprlem that allows you to 
not redownload it :
add this code in config-pan: 

btn-cancel "Cancel" [
			either exists?  mdp-config-file [ 
				unview/only config-win 
				if not viewed? main-win [mdp-gui-init]

   ][ alert "It's my first run baby !! ^/ You need to fill properly 
   the config form !!!" ]
			
		]
Group: AGG ... to discus new Rebol/View with AGG [web-public]
[unknown: 5]:
26-Jun-2005
I noticed that it doesn't work for 'btn no matter what size I choose
ChristianE:
26-Jun-2005
For BTN, which already has an EFFECT block, you'd have to append 
the DRAW block:
ChristianE:
26-Jun-2005
font-a: make face/font [name: "Arial Black" size: 24]
font-b: make face/font [name: "Arial" size: 12]
view center-face layout [
    btn 120x48 with [
        append init [

            append effect compose [draw [font font-a pen black fill-pen yellow 
            text 16x8 "Button" vectorial]]
        ]
    ]
    btn 20x120 with [
        append init [

            append effect compose [draw [transform -90 0x0 0x90 1 1 font font-b 
            pen none fill-pen black text 0x2 "vertical text" vectorial]]
        ]
    ]
]
Ashley:
5-Nov-2005
The following code demonstrates this. Comment / uncomment the draw 
effect line to see the difference a simple draw command makes.

count: 100

do-test: func [label info /local img-size start end] [
	img-size: to-pair label/text
	img: to image! layout [

  origin 0 box img-size blue reform ["Testing" img-size ". . ."] font 
  [size: 24]
	]
	view/new/options center-face layout [
		origin 0 i: image img img/size
		;effect [draw [circle 100x100 100]]
	] [no-title no-border]
	;	test loop
	start: now/time/precise
	loop count [show i]
	end: now/time/precise
	;	display result
	info/text: form to-integer count / (to-decimal end - start)
	show info
	unview
]

view layout [
	title "Resolutions"
	across la: label 100 "800x600" ia: info 100 center
	return lb: label 100 "1024x768" ib: info 100 center
	return lc: label 100 "1280x1024" ic: info 100 center
	return btn "Run" [do-test la ia do-test lb ib do-test lc ic]
]
shadwolf:
5-Dec-2005
stylize/master [
	rte: box with [
		color: gray 
	    tampon: ""
	    buffer: []
	    line-index: 0
	    char-sz: none
	  	current-text-offset: 0x0
	  	cursor-text-offset: 0x0
	  	max-text-offset: 0x0
	  	text-color: black
	  	pane: []
	  	
	  	set-font-style: func [ font-s [word!]] [
	  		switch font-s [

      bold [insert tail buffer compose/deep [[ [size: 11 style: [(font-s)]] 
      (either cursor-text-offset/x <> 0 [cursor-text-offset] [as-pair 0 
      (line-index * 20)]) "" ]]]

      normal [insert tail buffer compose/deep [[ [size: 11 style: []] ( 
      either cursor-text-offset/x <> 0 [cursor-text-offset][as-pair 0 (line-index 
      * 20)]) "" ]]]

      underline[insert tail buffer compose/deep [[ [size: 11 style: [(font-s)]] 
      (either cursor-text-offset/x <> 0 [cursor-text-offset][as-pair 0 
      (line-index * 20)]) "" ]]]

      italic [insert tail buffer compose/deep [[ [size: 11 style: [(font-s)]] 
      (either cursor-text-offset/x <> 0 [cursor-text-offset][as-pair 0 
      (line-index * 20)]) "" ]]]
	  		]
	  	]
	  	
		feel: make feel [
			engage: func [f a e] [
				switch a [
				   
					key [ probe e/key
						switch/default e/key [
							#"^M" [
							line-index: line-index + 1

       f/current-text-offset: as-pair 0 f/current-text-offset/y + 20]

       insert tail f/buffer compose/deep [[ [size: 11 style: [(font-s)]](as-pair 
       0 (line-index * 20)) "" ]]
							
						][
							f/tampon: rejoin [f/tampon to-string e/key]
							draw-text: []
							print "f/buffer:"
							probe f/buffer
							foreach line-to-draw f/buffer [
								print "line-to-draw"
							;line-to-draw: f/buffer/1
								;probe line-to-draw
							;set [font-style start-offset text-to-show ] line-to-draw
							
								font-style: line-to-draw/1
								start-offset: line-to-draw/2
								line-to-draw/3: rejoin [line-to-draw/3 to-string e/key]
							;probe font-style 
							;probe start-offset
							
								font-obj: make face/font font-style
							;probe font-obj 
								text-to-show: line-to-draw/3
								;probe text-to-show

         insert tail draw-text  compose [ font (font-obj) pen (f/text-color) 
         text (start-offset) (text-to-show)]
							] 
							;print "draw-text:"
							;probe draw-text
							

       ;draw-text: compose [ pen (f/text-color) text (f/current-text-offset) 
       (f/tampon)]
				    		f/effect: make effect reduce [ 'draw draw-text  ]
				    		draw-text: none 
				    		;probe f/current-text-offset

       f/cursor-text-offset: as-pair (f/cursor-text-offset/x + 9) f/current-text-offset/y 
				    		;show f
						]
						f/pane/1/offset: f/cursor-text-offset 
						show f
					]
					down [
						;insert f/buffer compose [(as-pair 0 (line-index * 20)) ""]
						focus f show f
					]
					
				]
			]
		]
		append init [

   insert buffer compose/deep [[[size: 11 style: []] (as-pair 0 (line-index 
   * 20)) ""]]
			probe buffer

   insert pane make face [ color: red size: 2x20 offset: cursor-text-offset 
    ]
			show self 
		]
	]
]


view layout [
  across
  	btn "bold" [test-rte/set-font-style 'bold]
  	btn "underline" [test-rte/set-font-style 'underline]
  	btn "italic" [test-rte/set-font-style 'italic]
  	btn "normal" [test-rte/set-font-style 'normal]
  return
  	test-rte: rte 300x300
]
amacleod:
9-Oct-2008
I'm doing something like this:

view layout [

 b: box effect [draw [pen red fill-pen red line-width 2 shape [line 
 0x0 40x0 40x40 0x40]
	]
	]

 btn "append draw" [append b/effect/draw compose ['pen green 'fill-pen 
 green 'shape ['line 5x0 30x5 5x25 0x20]]show b]
	]

Its much more complicated as I'm painting highlights on a series 
of faces in a panel. I go back and highlight in another color where 
a specified word is found. The hi-lite shows if its on a section 
of text not yet painted but not if it falls on painted text.

The above example works!

so it must be some where else in my app...

Thanks. I'll look it over...
amacleod:
9-Oct-2008
Actually I  don't like this behavior...its too complicated to remove 
it again.Back to my original plan of moving and resizing a box form 
face to face...

view layout [
	bx: box 100.100.255 0x0

 b: box effect [draw [pen red fill-pen red line-width 2 shape [line 
 0x0 40x0 40x40 0x40]]]
	at 40x40 text "Hello World"

  btn "append draw" [append b/effect/draw compose ['pen green 'fill-pen 
  green 'shape ['line 5x0 30x5 5x25 0x20]]show b]
	btn "Moving box" [bx/offset: 20x20 bx/size: 90x90 show bx]
	]
for example.


Now if I draw the box after the face it covers the textt which I 
want to avoid too.view layout [
	bx: box 100.100.255 0x0

 b: box effect [draw [pen red fill-pen red line-width 2 shape [line 
 0x0 40x0 40x40 0x40]]]
	at 40x40 text "Hello World"

  btn "append draw" [append b/effect/draw compose ['pen green 'fill-pen 
  green 'shape ['line 5x0 30x5 5x25 0x20]]show b]
	btn "Moving box" [bx/offset: 20x20 bx/size: 90x90 show bx]
Group: Dialects ... Questions about how to create dialects [web-public]
Pekr:
24-Aug-2009
>> view layout [b: btn "OK" red [probe b/effect]]
[colorize 255.0.0 128 extend 14]
Pekr:
24-Aug-2009
also remember, there are two button versions - button, and btn - 
slightly different. You might also be interested to look into RebGUI 
VID alternative ...
Group: SDK ... [web-public]
amacleod:
3-Mar-2009
I got it running...atleast the first 'main' window.  My buttons look 
funky...btn's have rounded ends and colors are different.
amacleod:
4-Mar-2009
New prob...

My buttons (btn) are not rendering properly...they are rounded at 
the ends. And other graphic elemnets are also rendered differently...

Is the draw dialect included in view.r source file?


I do not see anything that looks like draw.r in the source directory
Anton:
4-Mar-2009
Yep, when the BTN style came out it had rounder corners than now.
Group: !RebGUI ... A lightweight alternative to VID [web-public]
shadwolf:
5-Apr-2005
so things like view layout [ btn "EXIT" [quit]] would be writed in 
more than a sigle line in REBGUI ;)
ChristianE:
4-Jun-2005
;	15-Mar-2005 Pascal Lefevre
	;	27-Apr-2005 Pascal Lefevre

    ;    4-Jun-2005 Christian Ensel (minor color and shape suggestions)
	led: make face [
		size:	-1x4

  effect:	[draw [pen edge-color fill-pen window-color box 0x0 0x0]]
		font:	default-font
		para:	make default-para [origin: as-pair base-size 2]
		feel:	make default-feel [
			redraw: func [face act pos /local colors] [
				if act = 'show [
                    colors: reduce case [
						any [face/data = 1 face/data = true]  [
                            [btn-text-color btn-text-color]
                        ]
                        any [face/data = 0 face/data = false] [
                            [edge-color btn-up-color]
                        ]
                        true [
                            [edge-color white]
                        ]
                    ]
                    face/effect/draw/2: colors/1
                    face/effect/draw/4: colors/2
				]
			]
		]
		init:	does [
			if word? data [data: to logic! data]

   if negative? size/x [size/x: 1000000 size/x: 4 + para/origin/x + 
   first size-text self]
			effect/draw/6/y: unit-size 
			effect/draw/7: as-pair unit-size * 3 unit-size * 2,5
		]
	]
Graham:
13-Aug-2005
Occurring here ...

	colors: make object! [
		window:		236.233.216		; used by display.r
		widget:		244.243.238
;		widget:		248.248.248
		edge:		127.157.185
		edit:		white			; area, field, password, etc
		over:		gold			; active button, tab, splitter, etc
		menu:		49.106.197		; menu, popup highlight
		btn-up:		200.214.251
		btn-down:	216.232.255
		btn-text:	77.97.133
	]
Ashley:
8-Nov-2005
RebGUI and VID should work together as is. I've tried to avoid word 
name / context clashes for this very reason. Following should work:


 display "" [button "VID" [view/new layout [btn "Unview" [unview]]]]
Ashley:
9-Nov-2005
CTX-REBGUI/COLORS is an object of value:
	window          tuple!    236.233.216
	widget          tuple!    244.243.238
	edge            tuple!    127.157.185
	edit            tuple!    255.255.255
	over            tuple!    255.205.40
	menu            tuple!    49.106.197
	btn-up          tuple!    200.214.251
	btn-down        tuple!    216.232.255
	btn-text        tuple!    77.97.133

CTX-REBGUI/EDIT is an object of value:
	...
	tabbed          block!    length: 5
	hilight-on-focus block!   length: 2
	caret-on-focus  block!    length: 4
	action-on-enter block!    length: 3
	...

ctx-rebgui/widgets/set-sizes unit-size font-size


Plus many widgets have various option flags to control some aspect 
of their behavior.


Probably not skinning in the true sense but enough to change basic 
scale, colors and behaviors to cover the major use cases as they 
have been presented to me thus far. Skinning that lets you change 
"look & feel" to the extent that the GUI can mimic native Windows, 
OSX, C64, etc could be done but at what price in complexity and delivery 
time? And what percentage of folks would just stick with the default 
look & feel anyway. Another way of saying this is to ask whether 
it is a good idea to put 80% of your effort into satisfying the needs 
of 5% of your user-base?
shadwolf:
24-Nov-2005
rebol []
lg: 0
pos: 50x30
fen: layout/size [
at pos

b1: box white 150x20 "0%"  font [size: 11 color: black shadow: none] 
frame black 1
at pos + 1x1

b2: box 1x18 yellow effect [merge colorize 255.255.0 invert] with 
[
rate: 0
feel: make face/feel [
engage: func [face action event][
if action = 'time [
if (b2/size/x < 148) [
   lg: lg + 1
   b2/size: b2/size + 1x0
   b1/text: join to-integer lg / 147 * 100 "%"
   show [b1 b2]
   ]
   ]
   ]
]
]
t: text 100  form b2/rate
bt: btn "Stop" [
b2/rate: pick [0 none] 'none = b2/rate
bt/text: pick ["Stop" "Start"] "Start" = bt/text
t/text: form b2/rate
show [b2 bt t]
]
] 250x140
view/title center-face fen "Smart progress bar"
Pekr:
10-Jul-2006
Chris' buttons on the left - that is what I call nicely looking :-) 
http://www.xidys.com/btn-comparison.jpg
Oldes:
19-Feb-2007
no, I like the BTN style of button which is in Rebol by default
Ashley:
19-Feb-2007
will you guys build downloadable file once you reach merged and kind 
of stable release?

 Last stable build is #46 available via the View desktop and here: 
 http://www.dobeash.com/download.html


Once the current changes "settle down" (i.e. at least a week or so 
passes without a major new issue/problem) I'll update the stable 
set.

161kB.. it's pretty large
 ... 30+ widgets tends to do that! ;)

I like the BTN style of button which is in Rebol by default

 ... Come up with an AGG (not image-based) equivalent or similar and 
 I'll gladly use that.


re: tabs (and button) look. My previous goal was to try and map the 
look as closely as possible to WinXP. This required a combination 
of images and complex draw commands. My goal now is to keep it as 
simple as possible, with a nice clean look that can be implemented 
with as few effects/draw commands as possible. Button is an example 
of that. Instead of using 3 images and changing them based on current 
button state, I now use a simple draw block and change a single value 
based on state. Note that the radius is customizable (via effects/radius). 
Does this produce the best looking button ever? No. But don't fault 
the technique, rather my [limited] AGG compositional skills! Feel 
free to come up with a better button algorithm.


tabs are another example, where yellow lines of varying length were 
drawn to approximate the WinXP tab look, and had to be cleared and 
redrawn based on state changes. The new approach uses a simple effect 
block ( [round color 5] )where all that needs changing on a state 
change is the color. Same deal as button applies. Come up with a 
simple draw block that creates a good looking tab and I'll gladly 
use that.
Group: Cookbook ... For http://www.rebol.net/cookbook/requests.html [web-public]
DideC:
8-Jul-2005
main: layout [
  space 2 origin 4
  across

  style pane-tog tog of 'panels		; Just to avoid puting {of 'panels} 
  in each tog lines below
  pane1-tab: pane-tog 100x30 "Pane 1" [show-pane pane1]
  pane2-tab: pane-tog 100x30 "Pane 2" [show-pane pane2]
  pane3-tab: pane-tog 100x30 "Pane 3" [show-pane pane3] return
  content-pane: box 300x200 return

  btn white "Save" ; Save and Apply are used here for decorative purposes
  btn orange "Apply"
  btn sky "Close" [unview]
]
Group: Rebol School ... Rebol School [web-public]
Marco:
21-Aug-2011
The things are a bit more complicated. The situation is this:

win-copy: copy/deep win: [
	slider 100x20 across
	btn "ok" [win-copy: make win [] hide-popup]
	btn "Cancel" [win: make win-copy [] hide-popup]
]
win: layout win
win-copy: layout win-copy
view layout [btn "second win" [inform win]]


When the user presses ok the win layout should be copied to the win-copy 
face,

when the user presses Cancel the win-copy layout should be copied 
to the win face

so when the user presses ok it appears the previous modified layout,

when the user presses cancel it appears the previous layout but unmodified.

Obviously I could copy the faces values but in my application there 
are a lot
of gadgets and this would be a more general and simple solution.
todun:
6-Oct-2011
button-press?: layout [
    lines: read/lines %question-list.txt
    current-position: 1

;   len: length? lines                                           
                                                            

    show-one: btn "Show answer" [
        one-position: ++ current-position
        line: pick lines one-position
        result/text: line
	show result
    ]

    show-soon: btn "Soon" [

        soon-position: does [current-position: current-position + 5]
        line: pick lines soon-position
        result-soon/text: line
        show result-soon
    ]
    result: info " "
    result-soon: info " "
]
todun:
6-Oct-2011
>> do %circular_series.r
** Script Error: btn has no value
** Where: forever
** Near: show-one: btn "Show answer" [
    one-position: ++ current-position 
    line: pick lines one-position 
    result/text:...
todun:
6-Oct-2011
@Geomol, so why don't I put the DO[...] around code inside the btn 
blocks that are not like VID commands?
Group: SQLite ... C library embeddable DB [web-public].
Pekr:
13-Feb-2006
dunno of sqlite3 protocol, will try. I also found out, there is btn-sqlite.r 
or something like that (where btn = better than nothing), and it 
uses command line sqlite.exe to get the result :-)
Pekr:
13-Feb-2006
I mean Techfell and BTN protocols ...
Pekr:
13-Dec-2007
Well - there is btn-sqlite (better than nothing) driver on rebol.org 
It works, with one bad effect - black console window appearing during 
the shell call. Just recently I put it on high priority list for 
W.7.6 to be fixed - all is needed is to set one flag for shell call 
....
jrichards:
21-Jan-2010
Is this an accepted method of populating the fields of a view form 
or is there a more precise method?

btn-next: func[][
   if (counter  < (length? db)) [
    counter: counter + 1
    lname/text: db/:counter/2
    fname/text: db/:counter/3
    spouse/text: db/:counter/4
    email/text: db/:counter/5
    hphone/text: db/:counter/6
    cphone/text: db/:counter/7
    addr/text: db/:counter/8
    city/text: db/:counter/9
    state/text: db/:counter/10
    zip/text: db/:counter/11
    
    show window
    ]
]
Group: reblets ... working reblets (50-100 lines or less) [web-public]
Maxim:
19-Mar-2009
rebol [
	title: "explore.r"
	version 1.0
	date: 2009-03-19
	author: "Maxim Olivier-Adlhoch"
	copyright: "2009(c)Maxim Olivier-Adlhoch"
	tested: "win xp"

 notes: "Add any dir to the dirs block.  options are self explanatory"
]

dirs: [
	%/C/ []
	%"/C/program files/" [expand]
	"%tmp%" [label "temp dir"]
	"" [ label "my documents"]
]

blk: []

explore-dir: func [path expand? /local cmd][

 call/shell rejoin [" explorer " either expand? ["/n,/e,"]["/n,"] 
 path ]
]

ctr: 1
foreach [item opts] dirs [
	ctr: ctr + 1
	expand?: found? find opts 'expand
	label: any [select opts 'label to-local-file item]
	append blk compose/deep [ 
		pad 20 
		(to-set-word setw: rejoin ["dir" ctr]) check (expand?) 
		pad 20 

  btn 200 left (label) [ explore-dir to-local-file item get in (to-word 
  setw) 'data ]
	]
	append blk 'return
]


view layout compose [across vtext right "expand?" vtext "folder" 
 return (blk)]
Maxim:
19-Mar-2009
bug creep: parens disapeared for some strange reason...  replace 
in the above:


btn 200 left (label) [ explore-dir to-local-file item get in (to-word 
setw) 'data ]

with


btn 200 left (label) [ explore-dir (to-local-file item) get in (to-word 
setw) 'data ]
1 / 168[1] 2