[squeak-dev] Keyboard navigation in browsers?

Marcel Taeumel marcel.taeumel at hpi.de
Tue Nov 7 13:30:46 UTC 2017


At the level of ToolBuilder, one would rather have to specify a "tab order" and whether such a feature is enabled for a particular view or not. It would be like one or two additional fields in PluggableWidgetSpec. No need to talk about implementation details such as "siblings" at that abstract spec level.

Considering the actual implementation: there has been a "tabAmongFields", which might origin from Etoys. In the MorphicToolBuilder, I would simply add event filters for keyboard events at the level of PluggablePanelMorph and/or SystemWindow. You do not have to deal with implementation details in TextMorphs etc. If "tab" would be the key, "tab" would just not reach the TextMorph anymore. :-) ... off the top of my hat ... maybe like half a day work including tests. Not many new lines of code...

Best,
Marcel
Am 07.11.2017 09:24:12 schrieb H. Hirzel <hannes.hirzel at gmail.com>:
A modest but very useful enhancements would be to have the TAB key
changing between panes in the Browser [1] as it is an often used tool.

The method
PluggableListMorph specialKeyPressed: asciiValue [3]

shows what is currently interpreted. However all the keystrokes apply
only locally to the list.

Next thing to find out is if it is possible in tools built with the
ToolBuilder [2] framework how to get access to a sibling lists....


--Hannes


[1] Browser http://wiki.squeak.org/squeak/673

[2] ToolBuilder http://wiki.squeak.org/squeak/5607

[3] PluggableListMorph http://wiki.squeak.org/squeak/2093

specialKeyPressed: asciiValue
"A special key with the given ascii-value was pressed; dispatch it"
| oldSelection nextSelection max howManyItemsShowing |
(#(8 13) includes: asciiValue) ifTrue:
[ "backspace key - clear the filter, restore the list with the selection"
model okToChange ifFalse: [^ self].
self removeFilter.
priorSelection ifNotNil:
[ | prior |
prior := priorSelection.
priorSelection := self getCurrentSelectionIndex.
asciiValue = 8 ifTrue: [ self changeModelSelection: prior ] ].
^ self updateList ].
asciiValue = 27 ifTrue:
[" escape key"
^ ActiveEvent shiftPressed
ifTrue:
[ActiveWorld putUpWorldMenuFromEscapeKey]
ifFalse:
[self yellowButtonActivity: false]].

max := self maximumSelection.
max > 0 ifFalse: [^ self].
nextSelection := oldSelection := self selectionIndex.
asciiValue = 31 ifTrue:
[" down arrow"
nextSelection := oldSelection + 1.
nextSelection > max ifTrue: [nextSelection := 1]].
asciiValue = 30 ifTrue:
[" up arrow"
nextSelection := oldSelection - 1.
nextSelection < 1="" iftrue:="" [nextselection="" :="">
asciiValue = 1 ifTrue:
[" home"
nextSelection := 1].
asciiValue = 4 ifTrue:
[" end"
nextSelection := max].
howManyItemsShowing := self numSelectionsInView.
asciiValue = 11 ifTrue:
[" page up"
nextSelection := 1 max: oldSelection - howManyItemsShowing].
asciiValue = 12 ifTrue:
[" page down"
nextSelection := oldSelection + howManyItemsShowing min: max].
model okToChange ifFalse: [^ self].
"No change if model is locked"
oldSelection = nextSelection ifTrue: [^ self flash].
^ self changeModelSelection: (self modelIndexFor: nextSelection)



On 11/5/17, Marcel Taeumel wrote:
> Hi Bernhard,
>
> unfortunately, keyboard interaction in Squeak's tools is rather plain and
> hard-coded. If you want to look into code, here are the places:
>
> Editor, TextEditor, SmalltalkEditor >>
> #initializeCmdKeyShortcuts
> #initializeShiftCmdKeyShortcuts
> #dispatchOnKeyboardEvent:
>
> PasteUpMorph >> #filterEvent:for:
> DockingBarMorph >> #filterEvent:for:
> SystemWindow >> #filterEvent:for:
>
> PluggableListMorph >>
> #keyStroke:
> #previewKeystroke:
> #specialKeyPressed:
> #modifierKeyPressed:
>
> PasteUpMorph >> #keystrokeInWorld:
>
> All messages in the form "*Key:from:", which are usually the callbacks from
> PluggableListMorph.
>
> Best,
> Marcel
> Am 04.11.2017 23:34:34 schrieb tim Rowledge :
>
>> On 26-10-2017, at 8:13 AM, Bernhard Pieber wrote:
>>
>> Is there a way to move the focus between the different lists in a browser
>> by keyboard? I searched the mailing list and looked a bit in the code.
>> However, I did not find anything.
>
> I haven’t found anything either; it would be useful thing to have.
>
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Everybody repeat after me....."We are all individuals."
>
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20171107/0514d897/attachment.html>


More information about the Squeak-dev mailing list