Passing Click from Image to Field?

Scott Rossi scott at tactilemedia.com
Tue Dec 28 17:12:03 EST 2004


Recently, J. Landman Gay wrote:

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

> 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
> end clickToLine

Thanks to you and Jonathan Lynch for this idea.  I need to account for the
scroll of the field as well since it's a scrolling list.  I guess I have to
add the scroll of the field multiplied by the textHeight of the field to
figure out the equivalent clicked line.  Hmmm...

This is getting complicated but I guess it's my lot in life to develop
overly complex solutions. :-)

Thanks & Regards,

Scott Rossi
Creative Director
Tactile Media, Development & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com



More information about the use-livecode mailing list