pharo-spec / Spec

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

sbuildWidget method ni MorphicTextInputFieldAdapter #393

Closed Ducasse closed 5 years ago

Ducasse commented 5 years ago

sbuildWidget | plu | plu := RubPluggableTextFieldMorph new on: self text: #getText accept: #accept: readSelection: nil menu: nil setSelection: #setSelection:. plu entryCompletion: self entryCompletion; autoAccept: self autoAccept; ghostText: self placeholder; enabled: self enabled; encrypted: self presenter isVisible not; setBalloonText: self help; dragEnabled: self dragEnabled; dropEnabled: self dropEnabled; hResizing: #spaceFill; vResizing: #spaceFill; acceptOnCR: self acceptOnCR; maxLength: self presenter maxLength.

self presenter whenTextChangedDo: [ :text | plu setText: text ].
self presenter whenPlaceholderChangedDo: [ :text | plu ghostText: text ].
self presenter whenVisibilityChangedDo: [ :isVisible | plu encrypted: isVisible not ].  
self presenter whenMaxLengthChangedDo: [ :length | plu maxLength: length ].
^ plu
Ducasse commented 5 years ago

Was only in my image. Probably a bad edit of mine

Ducasse commented 5 years ago

For now I commented maxLength: and hide.... call. Next point: ghostText implementation.

Ducasse commented 5 years ago

I added a test and ghostText. Now I found strange that the ghostText is a RubEditingArea and not a RubTextFieldArea but I will ask Alain.