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

World: r3wp

[View] discuss view related issues

Anton
6-Aug-2005
[2076x3]
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.
Volker
6-Aug-2005
[2095x2]
With oops i would look at the docu now.
with /view i look at
  echo on
  probe get in get-style 'button 'feel,
the redraw, and see there face/color is set from face/colors.
trying to change that,
 face/colors/2: red

does not work. Hmm, face/colors is none. i guess i give button two 
colors immediate.
  button "Test" gold gold
yup, now it works.
Also button is not the best example for customisation, as it does 
a lot to be smart with the vid.arguments.
Gabriele
7-Aug-2005
[2097]
yes, you have to change face/colors, not face/color. this is very 
common in VID.
DideC
7-Aug-2005
[2098x4]
Button style has changed since 1.2.1.

In 1.2.1 when you provide color(s) for a button, the button was simply 
of this color(s), no effect.

So you can change button color after layouting by changing the face/colors 
facet.
Since some betas (arround 1.2.30, 1.2.40), the face/init style has 
evolved, and now, the face/colors are used to generate two gradient 
effects during the creation of the button.
So it's way more difficult to change it later.
You can compare the init code of 1.2.1 and 1.3.1 for button like 
this :
probe get in get-style 'button 'init
MikeL
7-Aug-2005
[2102]
Thanks for the help.  I was still having trouble because I was taking 
the default  button color in the the init layout then trying to change 
it based on some click action. If you default the button color, you 
can not change it.
Volker
7-Aug-2005
[2103x6]
Here is my test-script, comments below
view/new layout [across
	toggle "Test" gold "Test Reset" red [
		probe value
	]
	button "Test" [
		face/text: "Text Reset"
		face/colors: reduce [white red]
		show face
	] feel [
		redraw: func [face act pos /local state] [
			if all [face/texts face/texts/2] [
				face/text: either face/state [face/texts/2] [face/texts/1]
			]
			either face/images [
				face/image: either face/state [face/images/2] [face/images/1]
				if all [face/colors face/effect find face/effect 'colorize] [

     change next find face/effect 'colorize pick face/colors not face/state
				]
			] [

    if face/edge [face/edge/effect: pick [ibevel bevel] face/state]
				state: either not face/state [face/blinker] [true]
				if probe face/colors [face/color: pick face/colors not state]

    if probe face/effects [face/effect: pick face/effects not state]
			]
		]
	]
]
one is, maybe you want a toggle instead of a button?
that 'redraw is copypasted from original source (probe get in get-style 
'button 'feel).

then instrumented with a few probes. so i can track what really happens 
on  redraw.
seems it has to do with the effect. if i clear effect (face/effects: 
face/effect: none) i get pure colors. but with effects on it mysteriously 
does not work. dont understand that yet.
because i am not a graphics person ;) with default colors an effect 
looks like this: [gradient 0x1 66.120.192 44.80.132] and without 
[gradient 0x-1 32.32.255 173] . in first case last value is a color, 
in second an integer. seems the integer filters face/color, while 
the color-tuple overrides it.
MikeL
7-Aug-2005
[2109]
Thanks Volker et al.   I am using VID for a quiz for my kid's grade 
school studies - mostly history and science questions.  In this humble 
attempt, the button label is the answer to a multiple choice question. 
When an answer button is clicked it changes from a default color 
to green if it is a correct answer or red if it is a wrong answer. 
 This might offend UI experts but the button color change (when it 
works) gives immediate feedback.  Repeating the drill seems to bring 
the number of wrong clicks down until they get toward zero and grades 
seem to go up accordingly.
Volker
7-Aug-2005
[2110x3]
good idea :)
just as a side-effect i have discovered that buttons can blink. just 
set face/rate and show the face.
maybe thats feedback too? none stops, integer is "frames"/sec, a 
time the delay.
Pekr
7-Aug-2005
[2113]
my friend who codes in View after some time would like to ask, what 
changed in "focus" system since 1.2.1 - were there any changes since 
then?
Volker
7-Aug-2005
[2114x2]
if you want to dig into making own behavior, you can start with this:
view/new layout [across
	button with [
		source init
		source feel
		init: [copy needed stuff from init]
		feel: [copy and edit functions from feel]
	]
]
Pekr
7-Aug-2005
[2116x3]
He created his own grid and he would like to have more than one grid 
on-screen and would like to switch between them by tab. Can I make 
my own style being of 'tab-stop type? And how to let arrows etc. 
to works in terms of focused grid, not whole screen?
Volker - good point - I looked into new Doc and it does seem to be 
the most complete and nice doc ever! Maybe small section of how to 
start add own styles would fit it well?
well, although we are talking VID here, not View ... so maybe it 
should exist in terms of VID separate doc ...
Volker
7-Aug-2005
[2119x5]
and strip out all this "if color", since you know you if you have 
color or effect. May simplify code and give you better control. OTOH 
better come here and ask for special effects, if you need results 
instead of studying arcane view-magic :)
(sorry pekr, all this text was in my fingers pipeline ;)
doc - i think the combination of view/vid would be a good start. 

one thing to know is the facets. when you know them, all this magic 
in button-code suddenly looks lots simpler. all this ifs read like 
"turn on/off" in oops-doc then.

the other is how to get arguments from vid (that face/colors etc 
where they hide, and how to make face-specific words). when you can 
make a color-changing face and pass the colors thru vid that should 
give a cool feeling for the beginning :)
multi-grid - i have done that, but in a "hardwired" way. all the 
lists are in a global block, and tab knows about that.
then using hotkeys in the parent-face of the lists IIRC. Maybe you 
friend and me can start a thread somewhere to work on that? discussing 
ideas, me answering technical questions?
MikeL
7-Aug-2005
[2124]
Thanks again... my plan on the VID quiz was to post it on the script 
library when I get it working in 1.3.  

Then if it is worthwhile some new special effects can be added like 
blinking or sound or some graphing of results and journalling of 
scores.   


The hard part is still looking at the subject material and extracting 
questions that lead to some understanding of the material.
     

But once that is done, a student can review  dozens or hundreds of 
questions repeatedly in a different order each time.  


And a new quiz can be added just using a text file in rebol block 
format.  

And of course, the VID script and the data files could be internet 
read instead of being local.
Volker
7-Aug-2005
[2125]
Cool :) And then we make a rebol-quiz? :)