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

World: r3wp

[View] discuss view related issues

Benjamin
20-Aug-2005
[2264]
Again is there a way to know how many data is beeing saves to a file 
? write-net ? for example or is it just not possible w / rebol ? 
writing and reading both should share the callback option
Anton
20-Aug-2005
[2265]
Yes, it is possible. Will take a while to implement and bug-test, 
though. Ports must be opened in direct mode, eg. port: open/direct 
url
Robert
20-Aug-2005
[2266]
I have an iterated face function. This funciton stores some information 
that is than used later by an other function.


The problem I have is that the iterated function is executed when 
the VIEW command is exectuted. How can I call my other function AFTER 
the iterated function was exectued (the drawing is finished)? I thought 
that the iterated function is called at the time the LAYOUT command 
is used. Than I could call my other function before issuing a VIEW 
and it all would work. (BTW: The fact that the iterated function 
is called on VIEW and not LAYOUT should be documented).
Volker
20-Aug-2005
[2267]
Think of iterated function as another way of "show". Only that this 
show is called multiple times on a real show. One time for each row. 
so you can feed different data (and offsets!). Looks like multiple 
faces, needs space for one.
james_nak
20-Aug-2005
[2268]
HI again. I was wondering how you would approach this matter: I have 
a block of objects (all the same type - they are records of first 
name, last name, unique id, etc) I want to find the index of a particular 
object by unique id. I usually just go through a loop and check each 
object's id for a match and that works but is there a better way? 
 Thanks.
MikeL
20-Aug-2005
[2269]
James,  I have always (like sometimes) found it is better not to 
use index values but to use the REBOL block structure and expose 
the unique key separately in your data structure. e.g. 

data: [
    a [
        name "A"
        last-name "Alphabet"
    ]    
    b [
        name "B"
        last-name "Alphabet"
    ]
]

foreach [id blk] data [
    print [id blk/name]
]


The only reason that I can see to know the index is if you want to 
use it to index into a related data block / table but it would be 
better (in my opinion) to set the keys to allow that.  You don't 
need to know the index in this example because you can get the data 
block using the REBOL path notation.  Either 
select data 'b 
or data/b
or data/b/name
james_nak
20-Aug-2005
[2270]
MikeL, Very cool idea. Thanks.
Ladislav
20-Aug-2005
[2271]
James: see http://www.compkarori.com/vanilla/display/aa.r
Geomol
22-Aug-2005
[2272]
Is there a way to copy a part of an image from a certain position 
to another image at a certain position? Something like:

change/part at image1 5x5 at image2 10x10 20x20


That should take 20x20 pixels from image2 at position 10x10 and put 
them in image1 at position 5x5, but it takes from the start of image2, 
so it doesn't work as intended.
Anton
22-Aug-2005
[2273x5]
use SKIP not AT, I think. Let me test...
I kept tripping over that one...
Ahh.. Actually, yes, you can't control the start of image2. Yes, 
I asked about this soon after the release and was told it's not that 
important to implement in CHANGE. So you have to make a temporary 
image with the part of image2 that you want first.
That's a frustrating one. It would be so beautiful if that were implemented...
Robert, you can see http://www.rebol.com/docs/view-system.html#section-10
for more insight on how pane functions work.

An iterated face function is there to save memory, so it must be 
executed every time the display is refreshed. It creates the illusion 
of many faces by moving one face around very quickly.
It does not create and position new faces like LAYOUT.

What LAYOUT allows you to do is set up the pane function that will 
be used afterwards when SHOW is used or VIEW is used and events start 
flowing.
Geomol
22-Aug-2005
[2278x2]
Anton, maybe this is to way to do it? It seems to work:

change at image1 5x5 copy/part at image2 10x10 20x20
Using skip here seems to work aswell:

change at image1 5x5 copy/part skip image2 10x10 20x20
Anton
22-Aug-2005
[2280]
Yes, that is the way to do it.
Geomol
22-Aug-2005
[2281]
Makes me wonder about the difference between 'at' and 'skip'. Both 
are actions.
Volker
22-Aug-2005
[2282]
1.
Henrik
23-Aug-2005
[2283x2]
say I have: layout [a: tog true of 'panel b: tog of 'panel c: tog 
of 'panel]


what's the correct way for setting b to true so that a, b and c still 
behave as part of 'panel?
b to true = b/state to true
Gabriele
23-Aug-2005
[2285x3]
Henrik, this is the engage function for toggles:
engage: func [face action event][
    if find [down alt-down] action [
        if face/related [
            foreach item face/parent-face/pane [

                if all [flag-face? item toggle item/related item/related = face/related 
                item/data] [item/data: item/
state: false show item]
            ]
        ]
        face/data: face/state: not face/state

        either action = 'down [do-face face face/data] [do-face-alt face 
        face/data]
        show face
    ]
]
you should basically do the same thing (the foreach above)
[unknown: 5]
23-Aug-2005
[2288]
Someone had contacted me a month or so ago and asked for my modified 
text-list and was looking to make some updates.  I don't recall who 
it was but if your here - can you tell me if you improved such.
Henrik
24-Aug-2005
[2289x3]
paul, was that the one which supported custom colors per line?
I remember such a discussion, but that was 3-4 months ago. I didn't 
get anything done with it.
I'm working on a different implementation with a more advanced list 
system instead
Henrik
25-Aug-2005
[2292x2]
pekr, have you any private solution to the face accessor problem 
you mention so often?
gabriele, thanks. it works now :-)
Pekr
25-Aug-2005
[2294x2]
Henrik - no, I don't have any ....
I am more busy implementing some solutions so I only think loud from 
time to time :-)
Henrik
25-Aug-2005
[2296x2]
ok, but I'm anxious for a patch solution right here, mostly so that 
I can access numerous face/text's through a single object
it would be nice to find a working equivalent to:
>>a: make object! [b: 1]
>>c: a/b
>>c: 2
>>a/b
== 2 ; but actually returns 1...
Ladislav
25-Aug-2005
[2298]
c: in a 'b
set c 2
Henrik
25-Aug-2005
[2299x2]
ah, wonderful
not so wonderful:
>>layout [a: field "rebol" b: field "rules"]


>>fields: make object! [atext: in a 'text btext: in a 'text] ; how 
to bind a/text and b/text correctly?
>>fields/atext
== text ; word! incorrect

or:

>> fields: make object! compose [atext: (in a 'text)  btext: (in 
b 'text)]
>> fields/atext
== "rebol"

but then:
>>set in fields 'atext "test" ; incorrect way, apparently
>>fields/atext
== "test" ; good

>>a/text
=="rebol" ; but it didn't propagate back to the face....
Ladislav
25-Aug-2005
[2301]
layout [a: field "rebol" b: field "rules"]

fields: make object! [atext: in a 'text btext: in a 'text]

get fields/atext
Henrik
25-Aug-2005
[2302]
ok, that works, and if I would want to traverse all textfields in 
one go I started with:

>> set fields/atext "test" ; which works for one field

for multiple fields, I want to set each fields from an object:

>> inserts: make object! [atext: "rebol" btext: "rocks!"]

>> foreach i next first fields [attempt [set get in fields i get 
in inserts i]]
>> show [a b]


Fields are now changed properly in one go. Now I need to show the 
values in the foreach loop. I also need to allow the elements in 
the inserts object to be of arbitrary order.
Gabriele
25-Aug-2005
[2303]
>> view/new layout [a: text "Hello" b: text "World"]
>> fields: reduce [in a 'text in b 'text]
== [text text]
>> set fields "New" show [a b]
Henrik
25-Aug-2005
[2304x4]
Gabriele, interesting, but if I run
set fields "New" show [a b]
and do it multiple times with different strings, only the last one 
is set
hm... something with string lengths and the size of the textfield. 
:-) forget it.
Anton
25-Aug-2005
[2308x2]
set [a b c d] 1  ; this sets all of A B C and D to the same value, 
1.
set [a b c d] [1 2 3]   ; this sets A == 1, B == 2, C == 3, D == 
none.
Henrik
25-Aug-2005
[2310]
ok, not thoroghly tested but:

set-faces: func [faces data] [
  set

    reduce foreach var faces [insert tail [] compose [in (var) 'text]]
    get data
  show faces
]

view layout [a: field b: field c: field d: field]
faces: copy [a b c d] ; generate this from the layout?

data: make object! [a: "Eeny" b: "Meeny" c: "Miney" d: "Mo"]

set-faces data faces ; whammo!
Gabriele
25-Aug-2005
[2311x3]
hmm, i think what your are trying to do is what the panel accessors 
do by default (warning: a bit bugged, but easily fixable)
>> layout [pan: panel [a: field "something" b: field "else"]]
>> print mold get-face pan
[a: "something" b: "else"]
>> set-face pan ["Hello" "World"]
>> print mold get-face pan
[a: "Hello" b: "World"]
set-face does not allow [a: ...] while it should. I have a fix for 
it if you are interested.