How to create selection button

Use on long click event

I used long click event but after that click event wprk

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select “Download Blocks as Image”. You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun

I have no idea.
Please help

Use the OnLongClick block. When the user long click a button, add the component name or any information that will help you identify which button was long clicked into a list. I don’t know about the color over the image but you can add the checked symbol by just changing the button text.
Also you have to be able to unselect a previously selected button. So when the user long click, first check if the button is already in the list. If it is, then remove that item from the list and change the text to a space.

Thank you Italo for your great information. But One problem that when user LONG CLICK on a particular button ,after release fingers from that button CLICK event working automatically.
I can’t understand that how to prevent automatic CLICK event after pressing long click on that button

That shouldn’t be happening. Are you sure? Please show your blocks.

1 Like

Yes I am sure. After pressing long click event , automatically click event work
Okk I am showing you

Here Button1. Image = check mark icon
Button 6.image = play button png

if this is really the case, then you could fix it using the not Already Handled parameter…

if not Already Handled
then <add here your existing blocks of the Any button click event>

Taifun

Dear taifun it’s not working. After
I tried your suggestion I found the same problem. Any Button Click Event automatically occurred after pressing LONG CLICK EVENT

The user is right in my opinion. The clicked event shouldn’t be triggered after the long click event is registered.
I made my own test and it replicates the wrong behavior the user described.

LongClickTest.aia (23.6 KB)

Try adding not block and I believe it will work

Oops, you are right on that. Thanks @dora_paz.
But we are still trying to find a workaround to what seems to be a bug. The OnButtonClick event is triggered together with the OnButtonLongClick event. It shouldn’t be like that.

1 Like

And this notifier shows always TRUE. Even when I perform a long click.

1 Like

This seems to work:

3 Likes

I got this (extension) from the Power User forum (AI2)
@Ken

Screenshot

3 Likes

yes, this is a bug…
did you try it in MIT App Inventor? In case there is the same issue, then the MIT App Inventor team should fix it, else the Kodular team…

Taifun

1 Like

Yes, its the same in AI2.

1 Like

then let me suggest to start a new thread there and report this as bug


Taifun
3 Likes