r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[View] discuss view related issues

Gabriele
31-Oct-2008
[8250]
the "console" on Mac and Linux is just a terminal (OS provided), 
and they are usually UTF-8. That has nothing to do with View.
Robert
1-Nov-2008
[8251]
How can I return something when using DISPLAY/DIALOG when the dialog 
is closed? Something like:

result: display/dialog [...]

Or is this only possible via a wrapper function?
Graham
1-Nov-2008
[8252x2]
Sounds like Rebgui
display returns the layout ...
btiffin
1-Nov-2008
[8254]
Or  maybe

catch [display/dialog "test" [button "button" [hide-popup]] throw 
"result"]
which is equivalent to a wrapper function I guess
Gabriele
2-Nov-2008
[8255]
btiffin, why would you need the catch and throw there?
Robert
2-Nov-2008
[8256]
I solved it now by writing a function that collects and returns the 
result. And this function contains the DIALOG stuff.
btiffin
2-Nov-2008
[8257]
Sorry, this was an attempt to get round the none returned when the 
sysclose is used ... did I go overboard?  could be
Gabriele
3-Nov-2008
[8258]
what i meant was, why not just do [ display ... "result"] ?
btiffin
3-Nov-2008
[8259]
Yep.  Pull head out; breathe.  ;)
Henrik
4-Nov-2008
[8260]
Does anyone know how to adjust the saturation of a single RGB value?
Gregg
4-Nov-2008
[8261]
Chris Ross-Gill might know. He's done a number of color adjustment 
bits.
Henrik
4-Nov-2008
[8262]
It's interesting that I can find tens of places with getting the 
saturation of an RGB value, but not the other way around. I must 
be asking the wrong question.
Pekr
4-Nov-2008
[8263]
Henrik - the only thing I do remember from View 1.3 dev times is 
addition of rgb-to-hsv and hasv-to-rgb functions.....
Henrik
4-Nov-2008
[8264x2]
yes. They appear not to be present in R3.
(which is kind of fortunate, because I spent the whole day building 
them :-))
Pekr
4-Nov-2008
[8266]
IIRC, there was first a source version from Chris, then it was added 
as a native ...
Chris
4-Nov-2008
[8267x3]
http://www.ross-gill.com/r/hsv-lab.r
It's not exactly equivalent, rgb-hsv returns a block.  It's also 
a little slower...


[hue [integer!] saturation [decimal!] brightness [decimal!] alpha 
[decimal!]]
Hmm, also in the library:

http://www.rebol.org/view-script.r?script=hsv-lab.r
amacleod
4-Nov-2008
[8270x4]
Is there a way to get an index # from a text list selection?
text-list
face/text gives the string but can I get its position i the list?
actually its face/picked gives teh string..
Chris
5-Nov-2008
[8274]
index? find face/data face/picked
DideC
5-Nov-2008
[8275]
text-list in R2 has this problem cause it works on text value, not 
index. So it can't handle the same text value several times.
VID 3.4 actually return the index AFAIK.
amacleod
5-Nov-2008
[8276]
Thaks Chris, I thought there might be an internal method but as DIdC 
suggests there is not/
Geomol
5-Nov-2008
[8277]
Henrik, the hsv2rgb function, I made for Canvas RPaint. It takes 
H S V values as decimals in the area 0.0 - 1.0 as input:

hsv2rgb: func [
	H S V
	/local
		RGB
		var_h var_i
		var_1 var_2 var_3
		var_r var_g var_b
][
	RGB: 0.0.0
	either S = 0		;HSV values: 0 Ö 1
	[
		RGB/1: to-integer V * 255
		RGB/2: to-integer V * 255
		RGB/3: to-integer V * 255
	][
		var_h: H * 6
		if var_h >= 6 [var_h: 0]		;H must be < 1
		var_i: to-integer var_h
		var_1: V * (1 - S)
		var_2: V * (1 - (S * (var_h - var_i)))
		var_3: V * (1 - (S * (1 - (var_h - var_i))))
	
		switch var_i [
			0 [var_r: V			var_g: var_3	var_b: var_1]
			1 [var_r: var_2		var_g: V		var_b: var_1]
			2 [var_r: var_1		var_g: V		var_b: var_3]
			3 [var_r: var_1		var_g: var_2	var_b: V	]
			4 [var_r: var_3		var_g: var_1	var_b: V	]
			5 [var_r: V			var_g: var_1	var_b: var_2]
		]
	
		RGB/1: to-integer var_r * 255		;RGB results: 0 Ö 255
		RGB/2: to-integer var_g * 255
		RGB/3: to-integer var_b * 255
	]
	RGB
]
Henrik
5-Nov-2008
[8278]
Geomol, thanks
Geomol
5-Nov-2008
[8279]
Let me know, if you need the rgb2hsv as well.
Henrik
5-Nov-2008
[8280x2]
I'll be ok, I think. Right now I'm trying to find a bug in an hsl-to-rgb 
function.
and now fixed :-)
amacleod
10-Nov-2008
[8282x3]
Is there a way to have an area style that auto adjusts the height 
given a specific width so an entire paragraph will fit in the area. 
I know text style does this but I need to retain formatting.
I played with the sizing- 100x-1 etc. but it does not seem to work 
like 'btn style does.
Never Mind. I found the as-is statement added to style. Retains the 
formatting.
Henrik
11-Nov-2008
[8285]
amacleod, you may want to study BTN's INIT block, to see how it uses 
the -1 size.
amacleod
11-Nov-2008
[8286]
Henrik, I was looking at that too, Thanks. 
But 'as-is does what I need. Funny, I never saw it used before..
james_nak
17-Nov-2008
[8287]
I'm trying to create a function that builds radio buttons and checkboxes 
on the fly. Sunanda gave me some ideas about how to do that. This 
morning it dawned on me that I was going about it the wrong way. 
I was trying to build an entire string that represented the rebol 
code for the gadget instead of building a block of code.. What was 
happening was my contexts were all in error. 

I'm wondering now how to append my code into an existing layout block. 
The only working method I have found so far is to append into a non-layout 
block then "view layout blk." I'm still curious if there is a way 
to append/insert into a layout block though. E.g., 
a: layout [ btn "Quit" [unview halt] ]
b: [t1: check [ ] ]   <- this is my generated block
append a b

I get a "Script Error: append expected series argument of type: series 
port"
Henrik
17-Nov-2008
[8288x2]
remove the first layout and then create the layout afterwards.
all LAYOUT does is create a big object tree, and of course you can't 
just append blocks to that
james_nak
17-Nov-2008
[8290]
Thanks Henrik. That's what I needed to hear (how layout works).
Nicolas
17-Nov-2008
[8291x3]
insert-event-func [
	if event/type = 'key [
		print face/text
	]
event
]
view layout [area "hello"]

;Can a/text update before it prints?
;There's a one keystroke delay
that should be view layout [a: area "hello"]
Anton
17-Nov-2008
[8294]
Nicolas, you could modify the area's engage function, as in this 
patch.

append blk: select select second get in a/feel 'engage [switch act][key] 
bind [print face/text] blk/2
Nicolas
17-Nov-2008
[8295]
Thanks Anton. That was really helpful.
Anton
17-Nov-2008
[8296]
You're welcome.
Nicolas
21-Nov-2008
[8297x3]
REBOL []

index: func [dir list /local files] [
	files: sort load dir
	foreach file files [append list join dir file]

 foreach file files [attempt [if find file "/" [index dir/:file list]]]
] index %/c/ files: []

l: layout [
	f: field 600 [call t/picked]
	t: text-list 600x400 data copy files] 

search: func [f-string] [
	t/data: copy files  

 foreach s parse f-string none [remove-each f t/data [not find f s]]
	show t]


append blk: select select second get in f/feel 'engage [switch act][key] 
bind [search f/text] blk/2

focus f view l



if I type something into the field, then I click the slider, it calls 
t/picked. Why? i can't figure it out.
Sorry. That should be this.
index: func [dir list /local files] [
	files: sort load dir
	foreach file files [append list join dir file]

 foreach file files [attempt [if find file "/" [index dir/:file list]]]
] index %/c/ files: []

l: layout [
	f: field 600 [call t/picked]
	t: text-list 600x400 data copy files] 

search: func [f-string] [
	t/data: copy files  

 foreach s parse f-string none [remove-each f t/data [not find f s]]
	append clear t/picked t/data/1
	show t]


append blk: select select second get in f/feel 'engage [switch act][key] 
bind [search f/text] blk/2

append clear t/picked t/data/1
focus f view l



if I type something into the field, then I click the slider, it calls 
t/picked.