[squeak-dev] Keyboard navigation in browsers?

H. Hirzel hannes.hirzel at gmail.com
Tue Nov 7 08:24:01 UTC 2017


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 := max]].
	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 <marcel.taeumel at hpi.de> 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 <tim at rowledge.org>:
>
>> 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."
>
>
>
>


More information about the Squeak-dev mailing list