pharo-spec / Spec

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

Adding entry completion setter to SpRequestDialog #1540

Closed adri09070 closed 1 month ago

adri09070 commented 2 months ago

This would allow to remove a dependency to UIManager in the StDebugger:

requestProtocolIn: aClass

    | entryCompletion applicants choice |
    self class fastTDD ifTrue: [ ^ Protocol unclassified ].
    applicants := self protocolSuggestionsFor: aClass.
    entryCompletion := EntryCompletion new
                           dataSourceBlock: [ :currText | applicants ];
                           filterBlock: [ :currApplicant :currText | 
                               currText size > 3 and: [ 
                                       currApplicant asLowercase includesSubstring:
                                               currText asString asLowercase ] ].

    choice := (UIManager default
                   request:
                   'Start typing for suggestions (3 characters minimum)'
                   initialAnswer: Protocol unclassified
                   title: 'Choose a protocol'
                   entryCompletion: entryCompletion) ifNil: [ Abort signal ].

    ^ choice ifEmpty: [ Protocol unclassified ]

Plus, overall, I think this is a good addition to add entry completion in a dialog that asks the user to write text

Ducasse commented 2 months ago

Thanks adrian let us see what esteban will say. @estebanlm

Ducasse commented 1 month ago

Can we give some feedback to adrian or do we blindly integrate?

Ducasse commented 1 month ago

tx