Patrick Rein uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-pre.1465.mcz ==================== Summary ==================== Name: Morphic-pre.1465 Author: pre Time: 1 November 2018, 2:51:21.106173 pm UUID: b01c1a41-f7e1-2345-8c9a-6cc6f325a87c Ancestors: Morphic-eem.1464 Removes ProvideAnswerNotification code from several Morphs as it is now handled in the corresponding UIManager =============== Diff against Morphic-eem.1464 =============== Item was changed: ----- Method: DialogWindow>>getUserResponse (in category 'running') ----- getUserResponse | hand world | - (ProvideAnswerNotification signal: self message asString) - ifNotNil: [:answer| - ^ answer = #default - ifTrue: [result] - ifFalse: [answer]]. - self message ifEmpty: [messageMorph delete]. "Do not waste space." self paneMorph submorphs ifEmpty: [self paneMorph delete]. "Do not waste space." hand := self currentHand. world := self currentWorld. self fullBounds. self moveToPreferredPosition. self openInWorld: world. hand showTemporaryCursor: nil. "Since we are out of context, reset the cursor." hand keyboardFocus in: [:priorKeyboardFocus | hand mouseFocus in: [:priorMouseFocus | self exclusive ifTrue: [hand newMouseFocus: self]. hand newKeyboardFocus: self. [self isInWorld] whileTrue:[world doOneSubCycle]. hand newKeyboardFocus: priorKeyboardFocus. hand newMouseFocus: priorMouseFocus]]. ^ result! Item was changed: ----- Method: MenuMorph class>>chooseFrom:lines:title: (in category 'utilities') ----- chooseFrom: aList lines: linesArray title: queryString "Choose an item from the given list. Answer the index of the selected item." - "MenuMorph - chooseFrom: #('Hello' 'World' 'Here' 'We' 'Go') - lines: #(2 4) - title: 'What''s up?'" | menu aBlock result | - (ProvideAnswerNotification signal: queryString) ifNotNil:[:answer | - 1 to: aList size do:[:i| (aList at: i) = answer ifTrue:[^i]]. - ^0]. aBlock := [:v| result := v]. menu := self new. menu addTitle: queryString. 1 to: aList size do:[:i| menu add: (aList at: i) asString target: aBlock selector: #value: argument: i. + (linesArray includes: i) ifTrue:[menu addLine]]. - (linesArray includes: i) ifTrue:[menu addLine] - ]. MenuIcons decorateMenu: menu. result := 0. menu invokeAt: ActiveHand position in: ActiveWorld allowKeyboard: true. ^result! Item was changed: ----- Method: MenuMorph class>>chooseFrom:values:lines:title: (in category 'utilities') ----- chooseFrom: aList values: valueList lines: linesArray title: queryString "Choose an item from the given list. Answer the index of the selected item." + | index | + index := self chooseFrom: aList lines: linesArray title: queryString. + ^ valueList at: index ifAbsent: [nil]! - "MenuMorph - chooseFrom: #('Hello' 'World' 'Here' 'We' 'Go') - values: #('Hello' 'World' 'Here' 'We' 'Go') - lines: #(2 4) - title: 'What''s up?'" - | menu aBlock result | - (ProvideAnswerNotification signal: queryString) ifNotNil:[:answer | - 1 to: aList size do:[:i| (aList at: i) = answer ifTrue:[^answer]]. - ^nil]. - aBlock := [:v| result := v]. - menu := self new. - menu addTitle: queryString. - 1 to: aList size do:[:i| - menu add: (aList at: i) asString target: aBlock selector: #value: argument: (valueList at: i). - (linesArray includes: i) ifTrue:[menu addLine] - ]. - MenuIcons decorateMenu: menu. - result := nil. - menu invokeAt: ActiveHand position in: ActiveWorld allowKeyboard: true. - ^result! Item was changed: ----- Method: MenuMorph class>>confirm:trueChoice:falseChoice: (in category 'utilities') ----- confirm: queryString trueChoice: trueChoice falseChoice: falseChoice "Put up a yes/no menu with caption queryString. The actual wording for the two choices will be as provided in the trueChoice and falseChoice parameters. Answer true if the response is the true-choice, false if it's the false-choice. This is a modal question -- the user must respond one way or the other." "MenuMorph confirm: 'Are you hungry?' trueChoice: 'yes, I''m famished' falseChoice: 'no, I just ate'" | menu aBlock result | - (ProvideAnswerNotification signal: queryString) - ifNotNil:[:answer | ^ trueChoice = answer]. aBlock := [:v| result := v]. menu := self new. menu addTitle: queryString icon: MenuIcons confirmIcon. menu add: trueChoice target: aBlock selector: #value: argument: true. menu add: falseChoice target: aBlock selector: #value: argument: false. MenuIcons decorateMenu: menu. [menu invokeAt: ActiveHand position in: ActiveWorld allowKeyboard: true. result == nil] whileTrue. ^result! Item was changed: ----- Method: MenuMorph class>>inform: (in category 'utilities') ----- inform: queryString "MenuMorph inform: 'I like Squeak'" | menu | - (ProvideAnswerNotification signal: queryString) - ifNotNil:[:answer | ^ self]. menu := self new. menu addTitle: queryString icon: MenuIcons confirmIcon. menu add: 'OK' target: self selector: #yourself. MenuIcons decorateMenu: menu. menu invokeAt: ActiveHand position in: ActiveWorld allowKeyboard: true.! |
Free forum by Nabble | Edit this page |