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

World: r3wp

[View] discuss view related issues

shadwolf
12-Jul-2005
[1906x6]
Kru nice job why not to include this kind of mad widgets to rebgui 
?
mad but beauty full and original way to symbolise things like meters 
etc
can be used for example to symbolise network in/outgoing trafic :)
can ease t
some configuration range too instead of having a silder and a progress 
bar
I like the 3 kind of widgets both of you shows ;)
Rebolek
13-Jul-2005
[1912]
shadwolf why not, what's the difference between VID and REBGui widget?
DideC
13-Jul-2005
[1913]
It's not a bug but an intented behavior : it's a pair input style. 
There is for steps, each step can add any value to the pair. The 
repeat speed is also a parameter.
ie:

 stick-style speed 8 steps [1 2 5 10] ==> 8 is the repeat speed (rate) 
 and 1, 2, 5 and 10 are the values added to the pair!, depending how 
 you move the stick.


 stick-style value-mode decimal! ==> value is a block of 2 decimal! 
 values rather than a pair!
Anton
13-Jul-2005
[1914x10]
Nice Dide. :)
I have been looking at  feel/redraw  in more detail for the last 
couple of days.
And feel/redraw is a nice place to detect changes to the face, eg. 
when face/data changes, you can update the visual state of the face.
You can also do face/action when face/data changes. However, I found 
that it is *not* a good place to use TO-IMAGE (which might be in 
the face/action), because the latest image of the face has not been 
rendered yet.  Redraw's 'draw action occurs just *before* the face 
is rendered. So to get a chance to make a snapshot of the face using 
TO-IMAGE, I propose a  new redraw action, 'view, be sent after the 
face has fully rendered, allowing TO-IMAGE to be used at the right 
time.
Here is a demo showing the problem:
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]
]
The top image gets the result of TO-IMAGE of the box.
Does anyone else think that might be useful, and should I post a 
rambo ticket to request that ?
I understand that this extra action might slow View down a bit, so 
perhaps it could be switched on using a flag like   face/options: 
[redraw-view]
Kru, I noticed some things in your demo code: tachomtr.r
- COPY COMPOSE not needed, COMPOSE does a copy for you already.
- repeat i 10 [...]

where i is not used in the code block (you have a couple of those)
can become
  loop 10 [...]

This saves creating a context with the word 'i in it each time (which 
is what REPEAT does internally).
Rebolek
13-Jul-2005
[1924]
Anton thanks, I'll fix it
Anton
14-Jul-2005
[1925x4]
Ok, I don't need the new action anymore; I simply avoid recursion 
possibly caused by the face/action by setting flag. Here is a demo 
showing face action trying to recurse, and redraw catching this using 
the flag:
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]
	]
It's good (took me hours to arrive at this simple solution :)  Now 
the action block can do whatever it likes, including showing the 
face, and redraw can handle it.
Yep, I'm so happy about this. I'll be running around all my old styles 
updating them with this trick. Now I can continue with my more robust 
rotate-knob.
Ashley
14-Jul-2005
[1929x2]
Good find, I think it may be the answer to a few of my redraw problems 
as well! ;)
Might make a good cookbook entry as well.
BrianW
20-Jul-2005
[1931]
Is it possible to make View evaluate an expression and send the output 
to STDOUT under Windows? I'm not having any luck with my attempts:

	C:\Program Files\rebol\view\rebol.exe --do "print probe system"


This just opens the View Desktop, and doesn't seem to eval the statement.
Sunanda
20-Jul-2005
[1932]
I think this is as good as it gets:
    rebol -s --do "echo %out.txt probe system quit"
    type out.txt
BrianW
20-Jul-2005
[1933x2]
hmm ... that doesn't do it either. I decided to get Core and use 
that for my purposes.
(Working on rebol-helper functionality for Vim)
Gabriele
20-Jul-2005
[1935x3]
rebol -qw some-script.r | more
(you don't see the output if there is no redirection)
also, try -c
BrianW
20-Jul-2005
[1938]
My problem was that invoking View's rebol.exe always seems to pull 
up the Desktop.
Gabriele
20-Jul-2005
[1939x2]
do you have "launch desktop at startup" set?
but, if you provide a script, the desktop won't open.
BrianW
20-Jul-2005
[1941]
oops, yes I did have it set to start the desktop automatically
Gabriele
20-Jul-2005
[1942]
--do should override that, but currently it doesn't.
BrianW
20-Jul-2005
[1943]
oh, okay.
Anton
26-Jul-2005
[1944]
I found that my previous redraw action handling example is not quite 
perfect; when the effect block contains [merge luma 20] and the action 
block contains a show, and when the window is shown again after being 
covered by another window, then it appears the luma is applied twice 
(ie. twice as bright).
Anyone who copied the above example should add that as a note.
Ingo
26-Jul-2005
[1945]
Hi all,


if I want to know if there's any dirty face in a "window" is there 
a faster way than looping through all faces in the pane, and check 
wether they are dirty?
Sunanda
26-Jul-2005
[1946]
When I did something like that Ingo, I added my own dirty-data flag.

Had to put a dirty-data: true into the action facet of all input-able 
fields, of course.
Robert
26-Jul-2005
[1947x3]
Ok, another view question WRT panes. Here is my snippet:

	ad: box blue 280x36 with [pane: []]

	do [
		tmp: none

  start-date: to-date reduce [1 current-months/1 current-months/2]
		loop 31 [
			tmp: reduce ['txt 9x30 to-string start-date/day]
			if start-date/weekday >= 6 [append tmp [red]]

?? tmp
			append ad/pane layout tmp
			start-date: start-date + 1
		]

		show ad
	]
What I want to do is to add to AD for each day of a month (31) single 
panes, that have the number of the day as text and mark weekends 
in red. The numbers should appear top-down for numbers > 10. so like 
this:
1
0
the problem is, that the faces are added to the pane but I can't 
see anything... the box is blue.
DideC
26-Jul-2005
[1950]
You must change the offset of each face if you layout one by one. 
Otherwise they are all in the same "place".

Better would be to add VID code to the block into the loop then use 
layout at the end:
Robert
26-Jul-2005
[1951x2]
The problem is that I need to change some faces later. The days 28-31 
on demand.
That's why I wanted single faces to access them via the daynumber. 
pane/30/text: ""
DideC
26-Jul-2005
[1953x3]
view layout [
	ad: box blue 280x36 with [pane: []]

	do [
		tmp: copy [origin 0 space 0 across]

  start-date: to-date reduce [1 current-months/1 current-months/2]
		loop 31 [
			append tmp reduce ['txt 9x30 to-string start-date/day 25]
			if start-date/weekday >= 6 [append tmp [red]]
			start-date: start-date + 1
		]
		append ad/pane layout/offset tmp 0x0
	]
]
Should do the job
(remove the 25 in the block, useless)