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

World: r3wp

[View] discuss view related issues

Robert
5-Aug-2005
[2045]
update-calendar-weeks: func [face index /local tmp-face][
	either integer? index
		[
			if index <= length? cw-positions/(face/month) [
				tmp-face: calendar-week-faces/(face/month)
				tmp-face/offset/x: cw-positions/(face/month)/:index/x
				tmp-face/text: cw-positions/(face/month)/:index/y

				return tmp-face
			]
		]
		[
			return face/month
		]
]
Anton
5-Aug-2005
[2046x5]
I'll look at this code, but I just hacked a demo which might be interesting 
for you:
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
	]
]
I think your above function is a SUPPLY function, isn't it ?
My demo is programming the pane function directly.
Robert, would need to see more code. Nothing is jumping out at me 
yet. Have to go to sleep now, so perhaps tomorrow.
Robert
5-Aug-2005
[2051]
It's just a simple iterated face-function is described by Carl in 
his blog and view-doc.
Volker
5-Aug-2005
[2052]
show the parent-face
Robert
5-Aug-2005
[2053]
Will try this.
Izkata
5-Aug-2005
[2054x3]
Can anyone help me with what's going on here?
view layout [box 50x100 effect [arrow red] origin box 50x100 effect 
[arrow red rotate 270]]
I can't see why it's rotating the way it is - what I want is an arrow 
pointing left stretched vertically
DideC
5-Aug-2005
[2057]
view layout [box 50x100 effect [arrow red] origin box 50x100 effect 
[arrow blue rotate 270
fit]]
Izkata
5-Aug-2005
[2058x3]
ah
It's making the arrow before rotating, then -not- resizing it?
Alright thanx!  ^.^
DideC
5-Aug-2005
[2061]
de nada
Izkata
5-Aug-2005
[2062]
~Hides~

(School starts on the 24th, and I'm seriously thinking about dropping 
4th year Spanish)
Robert
6-Aug-2005
[2063]
view problem: showing the parent-face doesn't work because that's 
the whole window. The thing is, if the first draw is done and I than 
click into the box that has the iterated function attached, the text 
is shown.
Volker
6-Aug-2005
[2064x4]
Not sure i understand. but another try:  the list uses the first 
face returned, even if you return another one later. "tmp-face: calendar-week-faces/(face/month)" 
if this returns different faces, the first face would be reused forever. 
if thats the "The problem is, that the text drawn first is still 
there.", yes, it would be.
so the "display-face" has to be the same all the time. means, either 
copy your data in it, as you do within a supply-block. Or put your 
face in display-face/pane.
Should be mentioned in docu.
hmm, the new object-set/get may be used here. 
  set display-face get calendar-face
:)
Robert
6-Aug-2005
[2068x2]
I further investigated the problem. First I use three different boxes, 
that use the same iteration function. The iteration function uses 
different proxy faces. So, each box uses its own proxy face.
The thing is that I have a pane that's 200x20 in size. Within these 
200 pixels, I'm positioning 5 faces that have a with of 30 each. 
So there are areas where my function doesn't return a face for. And 
these areas are not cleared by View. So if I hit the older text, 
it's overwritten, if not it stays there.


The problem is, that the box, where the iteration function is used, 
isn't cleared before doing a refresh.
DideC
6-Aug-2005
[2070]
I think you must display iterated face in the whole box area, but 
you set the text and color of some of them to clear "what was here 
before".
Anton
6-Aug-2005
[2071]
I think it is strange that you are iterating different faces. That 
seems to defeat the purpose of iterating to start with. You should 
iterate one face. It is a single face which changes its position, 
shape and contents rapidly when it is asked for. You have to ensure 
that the face always has the correct information when it is asked 
for. But anyway, we can't make good suggestions unless we see a more 
complete demo that we can run.
Robert
6-Aug-2005
[2072x3]
Hmm... the thing is that the faces must have different positions. 
So it's not distributed evenly. The apps is this:

I have day numbers 1-30/31 from left to right. And now at each Monday 
position, I want to draw the week-number. So x-positions shift.
different face: It's just three month side by side. So forget it. 
The problem applies to one month.
and each month has it's own iteration face.
Anton
6-Aug-2005
[2075x4]
You are using a single iteration function to manage three faces. 
Hmm... I hesitate to say it can't be done, but maybe it isn't recommended... 
unless I misunderstand it.
The problem looks like it is that you are only updating one of the 
faces and returning it per call of the function. So any faces which 
weren't updated stay where they were.
So is the month very wide (1 - 30/31 days) or do they wrap at every 
week ? ie. are you trying to make an iterated version of my calendar-month 
widget ?
ie. 
	1 2 3 4 5 6 7 8 9 10 11 .... 
or
	1 2 3 4 5 6 7
	8 9 ...
Perhaps you can draw and show us a picture of it ?
DideC
6-Aug-2005
[2079x2]
I think you need 2 main faces:
- A normal iterated face for days.

- A classic face with 5 subfaces to display week. You just have to 
change offset, size and text according the monday location.
The problem is that iterated face are not designed to display things 
of differents size or offsets.

Iterated face works fine with linear offset changes that give always 
the same result.
Anton
6-Aug-2005
[2081]
That's not true. I've seen a demo of iterated virtual faces flying 
around everywhere.
Robert
6-Aug-2005
[2082x2]
Dide, I think that's the way I'm going to use. KISS ;-))
Just thought it could be done with iterated faces too.
Anton
6-Aug-2005
[2084x2]
I am certain it can be.
Dide, sorry, there is truth to what you say. But it can be done, 
too, just more work for the programmer.
Volker
6-Aug-2005
[2086]
So there are areas where my function doesn't return a face for. And 
these areas are not cleared by View.

 Thats why i said "show parent-face". then the whole background face 
 is redrawn, then the iterated faces in its pane-function.
Robert
6-Aug-2005
[2087]
there is no parent-face. It's the whole layout and I need to do an 
initailize while layouting ;-)
Volker
6-Aug-2005
[2088]
for coordinates, my demo-rebol-colorizer uses them. Positions faces 
freely over a text.
MikeL
6-Aug-2005
[2089]
Help ... I am trying to reset a button's background color with an 
action but am missing how to do that under View 1.3.  I think it 
worked before. I had thought it was:
  
view layout [button "Test" gold [
    face/text: "Text Reset" 
    face/color: red 
    show face
    ]
]
Pekr
6-Aug-2005
[2090x4]
Hi, I am not sure, just ask View gurus here, but imo button is still 
"crippled" design ....
Look at get-style 'button and its 'init method. Imo button is colorized 
in terms of effect block, so face/font/colors, nor face/color does 
apply ... and don't be confused by face/multi part ... it is imo 
used when multiple facets of the same kind are used, as e.g. "button 
red green ...
IIRC I once did such trick and I used to redefine 'effect part, but 
it was long time ago ... it is imo pity that such stupid simple things 
require hacker aproach to styles
that is also why I propesed more of usage of "accessors", simply 
to have face/something, where that "something" would be handler, 
which would take care of everything needed in terms of style. Currently 
View/VID does not provide us with proper encapsulation in terms of 
OOP - while we have complete freedom, non experienced user can be 
confused and mess things ...
MikeL
6-Aug-2005
[2094]
Thanks Petr ... I was hoping it was something simple that I was doing 
wrong.  


I have been probing the face objects for awhile and looking at the 
new View documentation.   I used the new View doc to get this to 
work 
face/color: get pick [green red] face/color = red 


from the example in a face but can't get the same satisfaction under 
VID layout button.