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

World: r3wp

[View] discuss view related issues

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).
Rebolek
16-Mar-2006
[4545]
Yes, that works. Great, Anton!
Maxim
16-Mar-2006
[4546x3]
anton:  WRT license,  (I had found that one  ;-) this only tells 
you that a pro license is installed... not the components which it 
enables...
since components of the pro package have changed from one version 
to another... its getting a bit tedious to hope everything is properly 
mapped...
and we aren't talking of other obscure packages like dll, link, sdk... 
for which I have no clue what is enabled.
MichaelB
16-Mar-2006
[4549]
I tried to create with the following code a circle with a transparent 
background and save it. I tried some different versions, but currently 
I have no glue how to achieve this. The point is I need a file with 
a circle and a transparent background :-) and I thought I quickly 
do this with Rebol instead of using a paintprogram. So am I doing 
something wrong ? It's saving the background from the window and 
if that is set to 'none then it's black ?

view layout [
    b: box 22x22 effect [
        draw [pen red line-width 2 circle 11x11 10]
    ]
    across 
    f: field 200 button "Save" [
        file-name: to-file f/text

        unless find/last file-name ".png" [append file-name ".png"]
        save/png file-name to-image b
    ]
]
DideC
16-Mar-2006
[4550x2]
There is some rebol-XXX? words and one is 'rebol-pro?
>> help rebol-
Found these words:
   rebol-command?  logic!    false
   rebol-encap?    logic!    false
   rebol-link?     logic!    false
   rebol-pro?      logic!    false
   rebol-view?     logic!    true
   to-rebol-file   native!   Converts a local
Seems pretty recent (almost 1.2.48, not in 1.2.8)
Geomol
16-Mar-2006
[4552]
MichaelB, maybe you wanna something like:
i: to-image b
repeat n length? i [t: i/:n t/4: 255 - t/1 poke i n t]
Gabriele
16-Mar-2006
[4553]
i: make image! 22x22
i/alpha: 255
draw i [pen red line-width 2 circle 11x11 10]
save/png %test.png i
Ashley
16-Mar-2006
[4554]
component? might be another one to try.
Geomol
17-Mar-2006
[4555]
Gabriele, much better than my solution! :-)
MichaelB
17-Mar-2006
[4556]
Thanks Gabriele, didn't even know that draw is a function which can 
be used stand-alone. (thanks to Geomol of course as well :-)
[unknown: 10]
20-Mar-2006
[4557x3]
Im getting all the time the same errors from /view 1.3.2.3.1 anyone 
kows if thats a known problem?
** Script Error: Invalid path value: dirty?
** Where: evt-func
** Near: if all [
    system/view/focal-face
    event/type = 'down
    not within? event/offset win-offset? system/view/focal-...
>>
>> unview
>> system/version
== 1.3.2.3.1
It always happens during events with the mouse.. like drag and drop 
up/down while dragging out of the window etc..
DideC
20-Mar-2006
[4560x2]
Maybe you use custom faces not based on 'VID-face but on 'face object, 
so there is some "properties" missing in your faces.


This code is from the global event handler and handle field/area 
loose of focus :

	 probe system/view/screen-face/feel/event-funcs
View set system/view/focal-face to editable face only (field, area).

So if you use it for other type of face that did not have 'dirty? 
property ==> Error!