Dear Squeakers,
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. Cheers, Bernhard |
> On 26-10-2017, at 8:13 AM, Bernhard Pieber <[hidden email]> 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; [hidden email]; http://www.rowledge.org/tim Everybody repeat after me....."We are all individuals." |
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:
PasteUpMorph >> #keystrokeInWorld: All messages in the form "*Key:from:", which are usually the callbacks from PluggableListMorph. Best, Marcel
|
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 <[hidden email]> 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 <[hidden email]>: > >> 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; [hidden email]; http://www.rowledge.org/tim > Everybody repeat after me....."We are all individuals." > > > > |
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
|
On 11/7/17, Marcel Taeumel <[hidden email]> wrote:
> 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. Good idea to capture (filter out) the TAB event at a higher level. Let's do more analysis on how this could be done. We could rely on a default TAB order which is just the order in which the elements were added (not including the switches) [4] > 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. PluggablePanelMorph does not seem to be used at all. In particular not in the Browser which is the most interesting tool to have the TAB key cycling through the panes. [5] So it is probably rather the SystemWindow class which is to be used. > 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... How is the method called to be used to filter out the TAB event? specialKeyPressed: as well? Regards Hannes > > Best, > Marcel > Am 07.11.2017 09:24:12 schrieb H. Hirzel <[hidden email]>: > 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 > [4] Browser buildDefaultBrowserWith: builder "assemble the spec for a full system browser, build it and return the built but not opened morph" "this build-but-don't-open phase is factored out to support the prototypicalToolWindow facility" | max windowSpec | max := self wantsOptionalButtons ifTrue:[0.42] ifFalse:[0.5]. windowSpec := self buildWindowWith: builder specs: { (0@0 corner: 0.25@max) -> [self buildSystemCategoryListWith: builder]. (self classListFrame: max) -> [self buildClassListWith: builder]. (self switchesFrame: max) -> [self buildSwitchesWith: builder]. (0.5@0 corner: 0.75@max) -> [self buildMessageCategoryListWith: builder]. (0.75@0 corner: 1@max) -> [self buildMessageListWith: builder]. (0@max corner: 1@1) -> [self buildCodePaneWith: builder]. }. self setMultiWindowFor:windowSpec. ^builder build: windowSpec [5] PluggablePanelMorph http://wiki.squeak.org/squeak/2748 |
Hi Hannes, just open SystemWindow >> #filterEvent:for: and add your tabbing logic. Access the currently focused morph via "anEvent hand keyboardFocus", compute a list of focus targets in the window via "self paneMorphs", unpack pluggable panels, choose the next focus holder, set the focus via "anEvent hand newKeyboardFocus: ...", and cancel event handling via "anEvent ignore". Of course we need PluggablePanelMorph for layout composition. The entire lower area in the browser is a panel. :) Best, Marcel
|
Free forum by Nabble | Edit this page |