A modest proposal for a new property

Richard Gaskin ambassador at fourthworld.com
Tue Sep 26 15:21:01 EDT 2017


Ralph DiMola wrote:

 > How would you use the alpha channel to do this? I just had an image
 > and the transparent part of the image did not send a mouseup message.
 > I put a button behind the image to solve it. Was there a way I could
 > have used the alpha channel to get the mouseup message anywhere in
 > the image and still retain the transparency?

An image which appears to the user to have empty regions will have those 
regions treated as empty by LC's default hit testing.  If doing your own 
hit testing you can adjust the threshold passed to the intersect 
function, but that's a lot of work compared to just using the best 
object for the job at hand:

If you need a rectangular clickable area with an image inside it, what 
you have is a button - you can set the icon of a button to the image you 
want displayed in it.

It's still two objects, but lets you store the image object in a 
separate stack where you can keep all of your image assets together, 
rather than adding an extra object to the UI stack.

Extra bonus points: FWIW when I last tested this (though it's been quite 
some time ago) buttons rendered much faster than images.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list