Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[vid] List Query

 [1/5] from: philb::upnaway::com at: 30-Dec-2003 10:06

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 ] ]

 [2/5] from: moliad:aei:ca at: 29-Dec-2003 21:50

hi Phil use win-offset? it returns the offset from any given face. -MAx

 [3/5] from: moliad:aei:ca at: 29-Dec-2003 22:08

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

 [4/5] from: didec:tiscali at: 30-Dec-2003 17:15

Re: [vid] List Query win-offset? and edge is on the bug list for view1.3. It is solve in development version 1.2.18. But I wonder if it can work with iterated face (text-list is a one) ? DideC

 [5/5] from: antonr:iinet:au at: 1-Jan-2004 23:25

You could modify the list's detect function and capture 'down events. Being the list's feel it will be from the list's point of view. Anton.