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

World: r3wp

[View] discuss view related issues

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)
Robert
26-Jul-2005
[1956x2]
Ok, but than I can access the single day texts, right?
I think this will get me further. Thanks.
DideC
26-Jul-2005
[1958x3]
If you change the last line by :
append ad/pane get in layout/offset tmp 0x0 'pane
then you can use:
ad/pane/1 ... ad/pane/31 to access each text face
Ingo
27-Jul-2005
[1961]
Thanks Sunanda, that should do the trick!
Anton
27-Jul-2005
[1962]
By the way, Robert, you can use FORM instead of TO-STRING.
Robert
27-Jul-2005
[1963]
Is there any difference between TO-STRING and FORM?
Anton
27-Jul-2005
[1964x2]
Not that I found.
form and mold go together, conceptually. FORM is like "convert to 
human readable form", while mold is like "convert to rebol readable 
form".
Ingo
27-Jul-2005
[1966]
There are differences in the handling of blocks! 

>> to string! [1.0 1 "1"]
== "1.011"
>> form  [1.0 1 "1"]
== "1.0 1 1"

Don't know about other differences at the moment.
Anton
27-Jul-2005
[1967]
Ah yes, differences like that. Mmm..
Izkata
29-Jul-2005
[1968x4]
Hey, anyone know if there's a way to return events to a face underneat 
the current one?
Like, make the checkbox here work, but keeping the box on top of 
it:
view layout [at 5x5 check 20x20 at 0x0 box 100x100 feel [detect: 
func [f e][e]]]
The best I can think of is looping through face/parent-face/pane, 
checking offsets, and activating the correct one... I'm hoping someone 
will have a nicer solution, though  ^.^
Gregg
29-Jul-2005
[1972]
What's the ultimate goal Izzy? That is, why do you have a face over 
the face?
Anton
29-Jul-2005
[1973x2]
You mean make a face "transparent" to events ? You click right through 
the box, and it hits the checkbox. I did something like that once....
It helps to know if the covering face is the same size and offset 
as the face below. (then you don't have to modify the event/offset)