[Pkg] The Trunk: Morphic-kb.318.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Feb 4 04:55:14 UTC 2010


Andreas Raab uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-kb.318.mcz

==================== Summary ====================

Name: Morphic-kb.318
Author: kb
Time: 4 February 2010, 2:27:58.374 am
UUID: 6cec3ca5-bd8c-4223-98ea-b0039e73e4d0
Ancestors: Morphic-kb.317

 - fix: MenuMorph releases selection for keyboard events. Before this you could not move through menu items with the cursor if it had a submenu.
 - fix: With left or right arrow now you can only move into a submenu. Before this those keystrokes were added to the filter if the selectedItem had no submenu.

=============== Diff against Morphic-kb.317 ===============

Item was changed:
  ----- Method: MenuMorph>>releasesSelection: (in category 'events') -----
  releasesSelection: evt
  	" The MenuMorph releases its selection if the selected item releases it. 
  	Used in #selectItem:event: "
  
  	self selectedItem ifNil: [ ^true ].
  	evt ifNil: [ ^true ].
+ 	evt isKeyboard ifTrue: [ ^true ].
  	(self selectedItem containsPoint: evt position) ifTrue: [ ^true ].
  	^self selectedItem releasesSelection: evt!

Item was changed:
  ----- Method: MenuMorph>>keyStroke: (in category 'keyboard control') -----
  keyStroke: evt 
  	| matchString char asc selectable help |
  	help := BalloonMorph string: 'Enter text to\narrow selection down\to matching items ' withCRs for: self corner: #topLeft.
  	help popUpForHand: self activeHand.
  	(self rootMenu hasProperty: #hasUsedKeyboard) 
  		ifFalse: 
  			[self rootMenu setProperty: #hasUsedKeyboard toValue: true.
  			self changed].
  	(evt commandKeyPressed and: [self commandKeyHandler notNil]) 
  		ifTrue: 
  			[self commandKeyHandler commandKeyTypedIntoMenu: evt.
  			^self deleteIfPopUp: evt].
  	char := evt keyCharacter.
  	asc := char asciiValue.
  	char = Character cr 
  		ifTrue: 
  			[selectedItem ifNotNil: 
  					[selectedItem hasSubMenu 
  						ifTrue: 
  							[evt hand newMouseFocus: selectedItem subMenu.
  							^evt hand newKeyboardFocus: selectedItem subMenu]
  						ifFalse: 
  							["self delete."
  
  							^selectedItem invokeWithEvent: evt]].
  			(selectable := self items) size = 1 
  				ifTrue: [^selectable first invokeWithEvent: evt].
  			^self].
  	asc = 27 
  		ifTrue: 
  			["escape key"
  
  			self valueOfProperty: #matchString
  				ifPresentDo: 
  					[:str | 
  					str isEmpty 
  						ifFalse: 
  							["If filtered, first ESC removes filter"
  
  							self setProperty: #matchString toValue: String new.
  							self selectItem: nil event: evt.
  							^self displayFiltered: evt]].
  			"If a stand-alone menu, just delete it"
  			popUpOwner ifNil: [^self delete].
  			"If a sub-menu, then deselect, and return focus to outer menu"
  			self selectItem: nil event: evt.
  			evt hand newMouseFocus: popUpOwner owner.
+ 			^evt hand newKeyboardFocus: popUpOwner owner ].
+ 	
- 			^evt hand newKeyboardFocus: popUpOwner owner].
  	(asc = 28 or: [asc = 29]) 
  		ifTrue: 
  			["left or right arrow key"
  
  			(selectedItem notNil and: [selectedItem hasSubMenu]) 
  				ifTrue: 
  					[evt hand newMouseFocus: selectedItem subMenu.
  					selectedItem subMenu moveSelectionDown: 1 event: evt.
+ 					^evt hand newKeyboardFocus: selectedItem subMenu]
+ 				ifFalse: [ ^self ] ].
- 					^evt hand newKeyboardFocus: selectedItem subMenu]].
  	asc = 30 ifTrue: [^self moveSelectionDown: -1 event: evt].	"up arrow key"
  	asc = 31 ifTrue: [^self moveSelectionDown: 1 event: evt].	"down arrow key"
  	asc = 11 ifTrue: [^self moveSelectionDown: -5 event: evt].	"page up key"
  	asc = 12 ifTrue: [^self moveSelectionDown: 5 event: evt].	"page down key"
  	matchString := self valueOfProperty: #matchString ifAbsentPut: [String new].
  	matchString := char = Character backspace 
  				ifTrue: 
  					[matchString isEmpty ifTrue: [matchString] ifFalse: [matchString allButLast]]
  				ifFalse: [matchString copyWith: evt keyCharacter].
  	self setProperty: #matchString toValue: matchString.
  	self displayFiltered: evt.
  	help := BalloonMorph string: 'Enter text to\narrow selection down\to matching items ' withCRs for: self corner: #topLeft.
  	help popUpForHand: self activeHand.
  !



More information about the Packages mailing list