Why does this code work differently in mac and windows

I have a problem with a code similar than the code below. In my mac I receive an input box with no “blank” values in the first dropdown item but in windows I always have a blank iteme in the first position.
What I’m doing wrong? Is there a better way to do that?

a = ["1.1 Columns", "1.2 Slab", "1.3 Fachade", "2.1 Columns", "2.2 Slab", "2.3 Fachade", "3.1 Columns", "3.2 Slab", "3.3 Fachade"]

prompts = ["Task?"]
defaults = ["Enter name"]
list = [a.join('|')]
input = UI.inputbox(prompts, defaults, list, "Tell me about the task.")
puts input

Mac screenshots:
Captura de pantalla 2023-01-16 a las 19.00.37

Windows screenshots:
Captura de pantalla 2023-01-16 a las 19.01.28

Captura de pantalla 2023-01-16 a las 19.01.41

The difference in the platforms is not the real problem.

Your default value for a picklist control must should be one of the choices, so try:

defaults = [ a[0] ]

ADD: If you really wish to have a blank value when the inputbox first appears, then one of the members of a needs to be "" (ie, an empty string.)

… then you can just set the default to this:

defaults = [ "" ]

… but you will also need to trap the condition when the user picks nothing and the result is an empty string value.

Thanks @DanRathbun . It was my final option. I didn’t know why on Mac the results were different.
I wanted to avoid empty string.

also - depending on the target users - “Fachade” is probably “Façade”

1 Like

Thanks for the corrections. And sorry for my poor English

no worries, Façade is a French word :slight_smile:

1 Like