"opaque pixels"

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7230
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: "opaque pixels"

Post by jacque » Fri Jan 21, 2022 8:32 pm

Klaus wrote:
Fri Jan 21, 2022 8:01 pm
only "mousedown" in the card script will get fired when clicking a tranparent pixel.
Putting the mouseDown handler in the image should fix that. If there are several images add a behavior that catches the mouseDown message.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9375
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: "opaque pixels"

Post by richmond62 » Fri Jan 21, 2022 8:37 pm

If folk had downloaded my stack with the octopus the rest of this discussion would not have taken place.

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: "opaque pixels"

Post by Klaus » Fri Jan 21, 2022 8:42 pm

Come on, guys, Samuele wants to fire a "mousedown" when he clicks the transparent pixels of an image!

That is hard to misunderstand, and my stack shows the workaround, since this is not possible with a "mousedown"
handler in the image.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9375
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: "opaque pixels"

Post by richmond62 » Fri Jan 21, 2022 8:53 pm

No, he doesn't, I am afraid you have things the
wrong way round.

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: "opaque pixels"

Post by Klaus » Fri Jan 21, 2022 9:02 pm

Well, that is how I understood his question.
is there a way to activate "mouseDown" only if the user clicks on the "opaque pixels" of the object?
Seems unambiguous to me.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7230
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: "opaque pixels"

Post by jacque » Fri Jan 21, 2022 11:20 pm

Klaus wrote:
Fri Jan 21, 2022 9:02 pm
Well, that is how I understood his question.
is there a way to activate "mouseDown" only if the user clicks on the "opaque pixels" of the object?
Seems unambiguous to me.
Opaque in this case means visible. He wants a mousedown to fire only if the pixels are visible.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: "opaque pixels"

Post by Klaus » Sat Jan 22, 2022 11:07 am

Aaaaaaaahhhhhhh, "opaque", yes, how embarrassing, sorry for the fuzz. :oops:

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: "opaque pixels"

Post by stam » Sat Jan 22, 2022 2:28 pm

Thanks guys that was a funny read ;)


@samuele -- yes long and short of it is that PNG images will allow you to do this.

There is a lengthy discussion of this here: viewtopic.php?f=7&t=35388&hilit=bullseye, i had jumped in halfway down the thread with a similar issue and came eventually to the conclusion that PNG is the only way to go, as Richmond advised then and now...

Stam

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7230
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: "opaque pixels"

Post by jacque » Sat Jan 22, 2022 6:57 pm

Klaus wrote:
Sat Jan 22, 2022 11:07 am
Aaaaaaaahhhhhhh, "opaque", yes, how embarrassing, sorry for the fuzz. :oops:
Someone might think that English wasn't your first language. :) But we still think you're clever.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9375
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: "opaque pixels"

Post by richmond62 » Sat Jan 22, 2022 7:25 pm

Nobody should ever say that Klaus is anything but clever, but as we all get older he should
also be allowed the odd 'senior moment'.

It was Klaus, in 2001, who pointed out to me why one should generally use mouseUp instead of mouseDown,
and I will forgive him everything for that piece of invaluable advice.

And if he makes half the mistakes I do . . . 8)

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: "opaque pixels"

Post by Samuele » Sun Jan 23, 2022 12:21 am

allright, thanks, but my probllem is actually this
pixelsInButton.livecode.zip
(207.34 KiB) Downloaded 68 times
sorry, my bad I didn't specify that I meant an id of an image in a button.
Thanks!
Samuele.
Samuele.

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: "opaque pixels"

Post by stam » Sun Jan 23, 2022 2:26 am

You can't do this as an image in a button; if you click a button, you click a button regardless if the image is there or not.

Instead you need to import the PNG image as control (FILE menu -> import as control -> image)

Then add a mouseUp handler to the image's script.

download an example stack here: https://www.mediafire.com/file/nq7f5sdn ... e.zip/file

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: "opaque pixels"

Post by Samuele » Sun Jan 23, 2022 2:20 pm

yes, but that will increase the size of the stack a lot (and then the app, and my stack is already large uselessly), because the images i import i use them more then once, that's why i made buttons with icons.
or is there a way to reduce the stack size?
thanks.
Samuele.

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: "opaque pixels"

Post by Klaus » Sun Jan 23, 2022 3:03 pm

No need to import all of your images!
This will also work with referenced images and will not add much to the filesize of the stack!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9375
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: "opaque pixels"

Post by richmond62 » Sun Jan 23, 2022 3:05 pm

Here's a stack which has an image on the first card (it has 4 cards)
and a graphic object "rr" on cards 2, 3 & 4 with its backGroundPattern set
to the image on card 1.
-
SShot 2022-01-23 at 16.02.06.png
-
SShot 2022-01-23 at 15.58.48.png
-
graphic objects WILL behave like the images they have as backGroundPatterns insofar as whether
mouseDown/Up clicks get a reaction out of transparent areas.
Attachments
Multiple usage.livecode.zip
Here's the stack.
(71.4 KiB) Downloaded 71 times

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”