Passing Click from Image to Field?
J. Landman Gay
jacque at hyperactivesw.com
Tue Dec 28 15:35:07 CST 2004
On 12/28/04 2:49 PM, Scott Rossi wrote:
> Looking for some new thinking on a problem:
> I have a translucent image which overlays a scrolling list field. I need to
> have the list field accept mouse clicks but because the overlaying image is
> only semi-transparent (not 100%) it prevents mouse clicks from reaching the
> list field.
> The only way I've been able to get around this is a kludge of locking the
> screen on mouseDown, hiding the image, using the click command to click at
> the mouse location, and then showing the image and unlocking the screen. It
> works, but it's a little slow, and I'm wondering if there might be a more
> efficient/programmatic solution.
> BTW, the image needs to appear above the list field because it semi-obscures
> the text at the edges of the field. Placing the image behind the field and
> making the field transparent isn't going to work in this case.
> Any other ideas?...
It depends on what you need to do, but you might be able to calculate
the line number from the clickV, then artificially set the hilitedlines
of the field to that line number, then send either a "mouseup" or a
"selectionChanged" message directly to the field (or some other custom
handler.) The field would need a mouseUp or selectionChanged handler
that examines its hilitedlines and takes action.
This will calculate a line number based on the click location:
function clickToLine tFldNum
put item 2 of the rect of fld tFldNum into tTop
put the effective textheight of fld tFldNum into tHt
return (the clickV - tTop) div tHt + 1
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode