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

World: r3wp

[View] discuss view related issues

PhilB
12-Mar-2006
[4495]
Gemol .... that is interesting (I understand now what is meant by 
a a graphical pipeline) but not quite what I wanted. 

I have a draw block with a number of images and I want to apply an 
effect indivdual images.
Anton
12-Mar-2006
[4496]
You must precompute the images with the effects, then use them in 
the final draw block.
Henrik
13-Mar-2006
[4497]
http://www.hmkdesign.dk/rebol/tab-view/tab-view.r<-- a very small 
demo.
ChristianE
13-Mar-2006
[4498]
Small, yet very nice! Clear and cool, reminds me on e.g. the buttons 
of my old tape deck. I think you've already said it before: the BTN 
style's look is nice, but it's way too under-represented in VID, 
making typical layouts look inconsistend. This one helps.
Henrik
13-Mar-2006
[4499x2]
yep, actually it was more inspired by the segmented button in OSX. 
I think it conveys a much better message of grouped buttons than 
just using TOG buttons with OF 'group
now I'm beginning to wonder how SCROLLER would look :-)
Graham
13-Mar-2006
[4501]
infinitely segmented button ?
Henrik
13-Mar-2006
[4502x2]
yeah
now I've run into the problem with VID elements sharing the same 
font object, which means that if I create three tab views, and change 
the font in the first one, the other two incorrectly also change. 
where exactly is this fixed? I've tried putting the font object inside 
the init code for the element, but this makes it impossible to change 
the font settings from within the layout.
Ashley
13-Mar-2006
[4504]
I hit that problem with shared para object and the fix was:

stylize/master [
	area: area with [insert tail init [para: make para []]]
]

so something similiar for font should work.
ChristianE
14-Mar-2006
[4505]
If it's the LAYOUT user who want's different fonts, let him specify 
them.

If it''s you wanting to to have e.g. a second bold font just for 
the pressed tab in one tab-view, I think you may for example allocate 
two font objects and dynamically swap them in the FEEL/REDRAW.
Code fragment:


 redraw: func [face action offset] [... face/font: pick face/fonts 
 face/state ...]

You may even get along with changing a single font object:


 redraw: func [face action offset] [... face/font/style: if face/state 
 ['bold] ...]
Anton
15-Mar-2006
[4506]
Henrik, yes, if you expect the user will want to change the font 
attributes, you should clone the font in INIT, like this :

	font: make font []


That clones the original, shared font object that the style comes 
with. Now every instance of your style has its own font object.

(The same goes for any other facets that are objects. If you don't 
want to share them, clone them in init.)
Henrik
15-Mar-2006
[4507]
now it's a chicken and egg thing. If I clone the object inside INIT, 
the font settings inside the layout is ignored, apparently because 
they are parsed before INIT is run.
Maxim
15-Mar-2006
[4508]
imagine all the fun I am trying using VID within GLayout  ;-)
Pekr
15-Mar-2006
[4509]
GWhat? :-)
Gabriele
15-Mar-2006
[4510]
henrik, just clone on change. VID also uses a flag in face/flags 
to indicate if a given subobject has been already cloned or not (so 
to clone only once)
Henrik
15-Mar-2006
[4511]
FACE/CHANGES ?
DideC
15-Mar-2006
[4512]
In face/flags, if 'font word is in the block, then the font has already 
been cloned.
Maxim
15-Mar-2006
[4513]
Pekr:  hahahaha
Anton
15-Mar-2006
[4514x4]
Henrik, can I see an example of what you mean by "font settings inside 
the layout" ? because I am not sure it's true, given:
view layout [style bx box "box" navy with [append init [font: make 
font []]] bx bx bx font-size 40 bx]
On Gabriele's note, use FLAG-FACE? to check for flags:

	>> layout [b: box]
	>> flag-face? b font
	== none
	>> layout [b: box font-size 30]
	>> flag-face? b font
	== [font]

and FLAG-FACE when you want to set a flag yourself.
so I suppose in INIT you might do:

	append init [
		if not flag-face? self font [  ; font not already cloned ?
			font: make font []   ; clone the font
			flag-face self font  ; remember that we cloned the font
		]
	]
Ashley
15-Mar-2006
[4518]
So simple! ;)
Anton
15-Mar-2006
[4519]
Strangely, I don't recall ever having to use this technique in my 
styles, and I'm sure I dealt with these issues.
Maxim
15-Mar-2006
[4520x3]
how do we know if current view or core version has access to pro 
features (a part from doing an /attempt on a lib call
/attempt = 'attempt
(catching an error if the call is not licenced)...  obviously this 
works, but its not very nice and it would be cool to be able to list 
available /pro features.
Maxim
16-Mar-2006
[4523]
I've browsed the 'system word throughout but didn't notice any place 
where the license made a difference when I enabled/disabled it.
Anton
16-Mar-2006
[4524x3]
system/user-license  ?
Yes, that changes. You could do:
got-pro-license?: found? system/user-license/id
BrianH
16-Mar-2006
[4527x2]
component? 'library
Never mind, component? doesn't return none when the component isn't 
enabled. That seems a little silly to me.
Gabriele
16-Mar-2006
[4529]
henrik: face/changes is used to optimize show. e.g. face/changes: 
'offset means that only the offset has changed, so there's no need 
to recompute the face, but it can just be blitted to the new location.
Rebolek
16-Mar-2006
[4530]
I've tried following to get 'b local in panel but 'b is still global

>>layout [panel with [b: none][b: button]]

Is there some other way?
Anton
16-Mar-2006
[4531x2]
layout [panel with [b: none][face/b: button]]
The action function cannot know for sure that self is the face, that's 
why face is passed into every action function each time.
Rebolek
16-Mar-2006
[4533x3]
aha, I see. Thanks Anton
It looks OK, but actually, it's not working.
>> layout [panel with [b: none][face/b: button]]
Misplaced item: face/b:
Anton you're right with 'face in action block, but what I want is 
to have local words not in action but in panel definition block.
Anton
16-Mar-2006
[4536x2]
oops I see.
That's what happens when I don't test first.
Rebolek
16-Mar-2006
[4538]
I know that very well :)
Anton
16-Mar-2006
[4539]
I have an idea.
Rebolek
16-Mar-2006
[4540]
Yes?
Anton
16-Mar-2006
[4541x4]
...
>> layout [p: panel with [ctx: none insert init [ctx: context [b: 
none] bind second :action ctx]][b: button]]
>> ctx
** Script Error: ctx has no value
** Near: ctx
>> b
** Script Error: b has no value
** Near: b
>> p/ctx/b/style
== button
So you might rename CTX to VARS to give it a meaningful name.
The above approach (storing the words in a context) makes it safe 
to add variables of any name (without having to check if it would 
override a some facet of the panel style).