[Cuis-dev] moving focus with tab key
Juan Vuletich
juan at cuis.st
Sat Feb 1 04:50:31 PST 2025
Gosh. Last minute rename gone wrong.
Fixed #tabToFocus: . Also added it to TextModelMorph. Hope it is correct
now.
Thanks for testing and sending feedback!
Cheers,
On 1/31/2025 9:40 PM, Mark Volkmann via Cuis-dev wrote:
> It seems that the way to change an instance of TextModelMorph to
> support using the tab key for moving focus is to do this:
>
> myInput scroller tabToFocus: false.
>
> This works great!, But I'm wondering if tabToFocus: should also be a
> method in TextModelMorph which delegates to InnerTextMorph (the
> scroller) so I don't have to know about scroller. Also, it seems like
> if I want that behavior, I should set it to true instead of false, but
> currently I have to set it to false.
>
> On Fri, Jan 31, 2025 at 1:44 PM Juan Vuletich <juan at cuis.st
> <mailto: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 <mailto: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 <mailto:Cuis-dev at lists.cuis.st>
>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>
>>
>>
>> --
>> R. Mark Volkmann
>> Object Computing, Inc.
>
>
>
> --
> Juan Vuletich
> cuis.st <http://cuis.st>
> github.com/jvuletich <http://github.com/jvuletich>
> researchgate.net/profile/Juan-Vuletich <http://researchgate.net/profile/Juan-Vuletich>
> independent.academia.edu/JuanVuletich <http://independent.academia.edu/JuanVuletich>
> patents.justia.com/inventor/juan-manuel-vuletich <http://patents.justia.com/inventor/juan-manuel-vuletich>
> linkedin.com/in/juan-vuletich-75611b3 <http://linkedin.com/in/juan-vuletich-75611b3>
> twitter.com/JuanVuletich <http://twitter.com/JuanVuletich>
>
>
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250201/180e6572/attachment-0001.htm>
More information about the Cuis-dev
mailing list