[Cuis-dev] moving focus with tab key

Mark Volkmann r.mark.volkmann at gmail.com
Fri Jan 31 14:50:39 PST 2025


That's excellent! I learned a lot implementing my solution, so no loss
there. I'll try out the new approach in my small demo app.

On Fri, Jan 31, 2025 at 1:44 PM Juan Vuletich <juan at cuis.st> wrote:

> Hi Mark,
>
> Thanks for raising this.
>
> I just pushed two changes that enable tab / shift-tab for all widgets
> except TextMorphs. But I also added a message to disable tab as a valid
> input. Then tab controls focus for them too.
>
> Additionally, adding ctrl makes it work regardless of the text morph
> handling tab as valid entry.
>
> Apologies if you feel this should have been sooner in Cuis, saving you
> some time.
>
> Thanks,
>
> On 1/30/2025 7:15 PM, Mark Volkmann via Cuis-dev wrote:
>
> I found a better way to handle the tab key for moving focus between text
> inputs.
> Rather than modify InnerTextMorph or TextModelMorph, I did the following:
>
> - Created a subclass of InnerTextMorph named InnerTextNoTabMorph.
>   This overrides the processKeystrokeEvent: method to be the same as in
> InnerTextMorph except it does not process tab key events.
>   I also added an onChange: method that takes a block that it evaluates
> every time it processes a key event.
>
> - Created a subclass of TextModelMorph named TextInputMorph.
>   This has an initialize method that sets up event handling to handle tab
> key presses and move focus appropriately.
>   It implements the innerMorphClass method to indicate that it wants to
> use InnerTextNoTabMorph instead of InnerTextMorph.
>   It implements the onChange: method to forward a block onto the same
> method in InnerTextNoMorph.
>
> With these classes in place, my Greeter class uses TextInputMorph in place
> of TextModelMorph
> and voila tabbing between text inputs works great!
>
> You can find all this code at
> https://github.com/mvolkmann/Cuis-Smalltalk-Greeter.
>
> On Wed, Jan 29, 2025 at 9:32 AM Hilaire Fernandes via Cuis-dev <
> cuis-dev at lists.cuis.st> wrote:
>
>> That would be neat. But a Tab option in TextModelMorph may prove to be
>> more useful for Widget as in Cuis-Smalltalk-UI.
>> Le 28/01/2025 à 22:06, Mark Volkmann via Cuis-dev a écrit :
>>
>> Thanks Juan! I'll see if maybe I can create a subclass of TextModelMorph
>> that has that behavior. Perhaps each instance of the subclass can hold a
>> reference to another morph that should take focus when the tab key is
>> pressed. Maybe I can create a set of morphs that have that ability such as
>> checkboxes, radio buttons, and so on. That would enable creating user
>> interfaces that are completely keyboard-driven as is common in web
>> interfaces.
>>
>> -- http://mamot.fr/@drgeo
>>
>> --
>> Cuis-dev mailing list
>> Cuis-dev at lists.cuis.st
>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>
>
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
>
>
>
> --
> Juan Vuletichcuis.stgithub.com/jvuletichresearchgate.net/profile/Juan-Vuletichindependent.academia.edu/JuanVuletichpatents.justia.com/inventor/juan-manuel-vuletichlinkedin.com/in/juan-vuletich-75611b3twitter.com/JuanVuletich
>
>

-- 
R. Mark Volkmann
Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250131/1876b1ad/attachment.htm>


More information about the Cuis-dev mailing list