I meant to say:

it returns the offset FOR any given face (from window)

I also have checked that the win-offset? (after sourcing it and doing a test) does not 
take into consideration the edges... so that if you compare the value returned by 
win-offset and a place a face at that location within the root face , you will have an 
offset equal to all nested faces without their edge sizes...


here is a patch which fixes this, I'm quite sure its been suggested before, but it was 
so simple to do... It would have taken me more time to find it...


win-offset?: func [
    {Given any face, returns its screen absolute offset.}
    face [object!]
    /local xy
][
    xy: 0x0
    while [face] [
        if face/parent-face [
                xy: xy + face/offset
                if face/parent-face/edge [xy: xy + face/parent-face/edge/size]
        ]
        face: face/parent-face
    ]
    xy
]


HTH!!!

-MAx

> === Original Message ===
> 
> 
> hi Phil
> 
> use win-offset?
> 
> it returns the offset from any given face.
> 
> 
> -MAx
> 
> > === Original Message ===
> > 
> > 
> > Hi,
> > 
> > I have a query on how to use list.
> > I want to know the offset from the *window* of the mouse when I press
>  the
> >  down button.
> > event/offset only gives me the offset from the text field of the list.
> >  (see code below)
> > 
> > Any help would be appreciated.
> > 
> > Cheers Phil
> > 
> > 
> > rebol []
> > 
> > data: ["AAA" "BBB" "CCC" "DDD" "EEE" "FFF" "GGG" "HHH"]
> > 
> > view layout [
> >     list [
> >         f: text 100 feel [
> >             engage: func [face action event] [
> >                 if event/type = 'down [
> >                     print event/offset
> >                 ]
> >             ]
> >         ]
> >     ]
> >     supply [
> >         if count > length? data [face/show?: false exit]
> >         face/show?: true
> >         f/text: pick data count
> >     ]
> > ]
> > 
> > 
> > 
> > -- 
> > To unsubscribe from this list, just send an email to
> > [EMAIL PROTECTED] with unsubscribe as the subject.
> > 
> > 
> -- 
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
> 
> 
-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to