Alert with button list problem

Hi, I’m using an alert with button list, set in the designer part. However, how can I know which button does the user clicked?

Hey @label1.visible-true

What do you want to do with that information?

i.e. can you just display the text from the label, or will you need a parallel list to display the appropriate value?

For example, here’s a screen with 5 buttons:

and then clicking on each buttons returns it’s individual position in the list of buttons:

I am talking about the alert button.
I am wondering if anything can tell me which button is pressed.

Hi there,

The ‘showButtonList’ block will return an output called ‘buttonPressed’.
This will return the position of the Button in your Button List.
You can take some action based on which button was pressed.

You can find more info about the Button List of the Alert in the Alert docs.

1 Like

@jane Thank you very much! That’s what I am asking for.
Just to confirm, in this image
image
“Sure” is number 1
“No thanks” is number 2
“Don’t show that again” is number 3
Am I right?

Assuming you mean “Later”, as seen in the image, and not “no thanks”, which I don’t see in this screenshot, then yes, that’s correct.

The Buttons may appear in a different order when Live Testing the app on a device, but the number that ‘buttonPressed’ returns is the order that the Buttons are added in the app project.

1 Like

oops :sweat_smile:

Thank you very much.

Btw, it is not stated in the documentation, will you or other staff add it?

I’ll add that note, thanks for the feedback!