🟧 Spinner Setup

The spinner component is an odd thing, and requires some rigour to get control of it.
This is how I usually setup a spinner so that all the selections are available every time. I use a button to set the selection and call the spinner dropdown, and "hide" the spinner by setting its height and width to 1 pixel each. If placed inside a centred horizontal arrangement, the spinner should be invisible in all themes. Note: something has recently changed with the spinner, it seems you can now set height and width to 0, and the spinner will still work as expected.

By adding a "Close Menu" selection (it can be called what ever you want) at the first index, and by setting this before calling the drop down, all preferred selections are available, and selecting "Close Menu" from the drop down does nothing other than close the drop down. You then use if/else blocks to action the other selections as required.

BLOCKS

EXAMPLE AIA PROJECT

spinnerSetup.aia (2.7 KB)

5 Likes

2 posts were merged into an existing topic: Spinner not opening new screen?

The only way I could get the spinner to work properly is to set "Spinner Visible to True" when clicking on the Button and setting "Spinner Visible to False" at the end of AfterSelecting spinner.

That is one way of doing it, but it should work if the spinner is always visible, but you resize it to 1x1 pixels to make it, to all intents and purposes, invisible. (Depends then on its placement on the screen)

Thanks for the idea, why not just set height and width to 0? Also works.
You can also set the size of the spinner to about 30x30 if you want to see the down arrow.

You will find it does not return a selection if you do that.

Yes indeed, as indicated below, something has changed....

This seems to have changed. On my current test devices (Android 13 & 14) it also works when height and width are set to 0.

1 Like

I will test it out, bonus if it works :wink:

Yep, tested companion and compiled Android 7 and Android 13, works on both.

Thanks for the heads up @Anke :+1:

There is a detail in my case

When I select the element for the first time it loads the name to the button

When I try to make the second selection the content is automatically unchecked
and I have to select again

I would like the text to remain on the button if I do not select and exit with the Esc button on my keyboard.

first selection ok
image

uncheck and select empty
image

Remove this block:

image

You cannot select an item without firing the afterSelecting event

How do I use the aia file to see the sample?

Download it and open it AI2

got it...thanks ...learning this system is interesting