pharo-spec / Spec

Spec is a framework in Pharo for describing user interfaces.
MIT License
61 stars 63 forks source link

SpSelectDialog should select the first item #1530

Closed Ducasse closed 3 months ago

Ducasse commented 3 months ago

SpSelectDialog should select the first item.

estebanlm commented 3 months ago

you mean like by default?

Ducasse commented 3 months ago

Yes. And may be with a message not to do it for people that do not understand UX. Like that we can often do enter and get done :)

estebanlm commented 3 months ago

Uhm... it seems is already like that:

SpSelectDialog>>items: aCollection

    list items: aCollection.
    aCollection size > 1
        ifTrue: [ list selectItem: aCollection first ]

and testing it, it seems to work:

StPharoApplication current newSelect
    items: #(x y z);
    openModal.

EDIT: And now that I see, you did that, in December :)

estebanlm commented 3 months ago

maybe better just to ask for not empty, instead size?

Ducasse commented 3 months ago

This is strange because in some refactorings the first item is not selected and this is why I thought that we lost it. Yes size > 1 is a bad idea since this is my bug. If you have a list with only element then you still want to select it. Good cath!

Ducasse commented 3 months ago

So it was not lost but I just badly coded it.