Balázs Kósi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-kb.410.mcz ==================== Summary ==================== Name: Morphic-kb.410 Author: kb Time: 5 April 2010, 4:22:43.288 pm UUID: e7381b65-efe2-470b-8388-840148e7c55a Ancestors: Morphic-cmm.409 - SearchBarMorph >> smartSearch: retains keyboard focus if no match was found. =============== Diff against Morphic-cmm.409 =============== Item was changed: ----- Method: SearchBarMorph>>initialize (in category 'initialize') ----- initialize super initialize. text := Text new. backgroundColor := TranslucentColor gray alpha: 0.3. self width: 200. + self crAction: (MessageSend receiver: self selector: #smartSearch:). - self crAction: (MessageSend receiver: self selector: #smartSearch). self setBalloonText: 'Searches for globals and methods'.! Item was added: + ----- Method: SearchBarMorph>>smartSearch: (in category 'search') ----- + smartSearch: evt + "Take the user input and perform an appropriate search" + | input newContents | + input := self contents asString ifEmpty:[^self]. + (Smalltalk bindingOf: input) ifNotNil:[:assoc| | global | + "It's a global or a class" + global := assoc value. + ^ToolSet browse: (global isBehavior ifTrue:[global] ifFalse:[global class]) selector: nil. + ]. + (SystemNavigation new allImplementorsOf: input asSymbol) ifNotEmpty:[:list| + ^SystemNavigation new + browseMessageList: list + name: 'Implementors of ' , input + ]. + input first isUppercase ifTrue:[ + (Utilities classFromPattern: input withCaption: '') ifNotNil:[:aClass| + ^ToolSet browse: aClass selector: nil. + ]. + ] ifFalse:[ + ^ToolSet default browseMessageNames: input + ]. + newContents := input, ' -- not found.'. + self + newContents: newContents; + selectFrom: input size+1 to: newContents size. + evt hand newKeyboardFocus: self! Item was changed: ----- Method: TextMorph>>keyStroke: (in category 'event handling') ----- keyStroke: evt "Handle a keystroke event." + - | action | self resetBlinkCursor. "don't blink during type-in" + evt keyValue = 13 ifTrue: [ "CR - check for special action" + self crAction ifNotNil: [ :action | - evt keyValue = 13 ifTrue:["CR - check for special action" - action := self crAction. - action ifNotNil:[ "Note: Code below assumes that this was some input field reacting on CR. Break the keyboard focus so that the receiver can be safely deleted." evt hand newKeyboardFocus: nil. + ^action valueWithEnoughArguments: { evt } ] ]. + self handleInteraction: [ editor readKeyboard ] fromEvent: evt. - ^action value]]. - self handleInteraction: [editor readKeyboard] fromEvent: evt. "self updateFromParagraph." super keyStroke: evt "sends to keyStroke event handler, if any"! Item was removed: - ----- Method: SearchBarMorph>>smartSearch (in category 'search') ----- - smartSearch - "Take the user input and perform an appropriate search" - | input newContents | - input := self contents asString ifEmpty:[^self]. - (Smalltalk bindingOf: input) ifNotNil:[:assoc| | global | - "It's a global or a class" - global := assoc value. - ^ToolSet browse: (global isBehavior ifTrue:[global] ifFalse:[global class]) selector: nil. - ]. - (SystemNavigation new allImplementorsOf: input asSymbol) ifNotEmpty:[:list| - ^SystemNavigation new - browseMessageList: list - name: 'Implementors of ' , input - ]. - input first isUppercase ifTrue:[ - (Utilities classFromPattern: input withCaption: '') ifNotNil:[:aClass| - ^ToolSet browse: aClass selector: nil. - ]. - ] ifFalse:[ - ^ToolSet default browseMessageNames: input - ]. - newContents := input, ' -- not found.'. - self - newContents: newContents; - selectFrom: input size+1 to: newContents size! |
Hi,
You need to run [ TheWorldMainDockingBar updateInstances ] to get this working. The expression above is in the postscript of the Morphic package, but somehow it doesn't get executed. Balázs |
Free forum by Nabble | Edit this page |