Hi, sins you dislike Spec I cannot resist to taunt you with these 3 lines of Spec code that do what you want :-P field := TextInputFieldModel new autoAccept:true; acceptBlock: [:text | field text: text asUppercase]. field openWithSpec Note that the transform here is a simple asUppercase, replace that with whatever logic suits you. Spec does have its advantages :-)
On Nov 10, 2015, at 16:03, Dimitris Chloupis <kilon.alios@gmail.com> wrote:
I have taken a look at rubric elemenst, they look even more messier than morphic. I can do something similar with textMorph without messing with announcers. It looks to me a bit too much to send an announcement on a key event.
Anyway I will give a try at textMorph and will go from there, probably subclass it and create my own morph for time input.
"and it got cleaned :)
Stef"
Well my experience with other language has taught me GUI APIs are generally a nightmare to work with, the only exception to this rule was DELPHI, those guys were just awesome at GUI design. VCL was simple yet incredible flexible, I would even dare say the smalltalky thing I have used. It takes a ton of effort and expertise to get it that good.
I hope Bloc makes a bit more sense than Morphic, Rubric and Spec.
On Tue, Nov 10, 2015 at 7:59 PM Stephan Eggermont <stephan@stack.nl <mailto:stephan@stack.nl>> wrote: On 10-11-15 18:16, Dimitris Chloupis wrote:
What I want is to create a morph that has the ability to input text from the user that formats it automatically and allows for a limited amount of characters.
You might want to take a look at RubFloatingEditorBuilder. In #buildEditor you see how to react to announcements send by the RubScrolledTextMorph. If you do The Right Thing in whenKeystroke: (like #setTextWith: and fixing the selection and cursor position) you'll be able to do what you want.
Stephan
---> Save our in-boxes! http://emailcharter.org <--- Johan Fabry - http://pleiad.cl/~jfabry PLEIAD and RyCh labs - Computer Science Department (DCC) - University of Chile