Chris Muller uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cmm.1407.mcz ==================== Summary ==================== Name: Morphic-cmm.1407 Author: cmm Time: 30 March 2018, 5:59:05.775759 pm UUID: d60bae6d-7ac8-4ac6-90d4-ef2adbbe7d68 Ancestors: Morphic-mt.1406 - Allow particular subwidgets of dialogs to be positioned directly under hand instead of only under the center of the entire dialog (under the hand). - Fix for PluggableMultiColumnListMorph when Smart Splitters is enabled. =============== Diff against Morphic-mt.1406 =============== 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 center: preferredPosition. - self bounds: (self bounds translatedToBeWithin: world bounds). self openInWorld: world. hand showTemporaryCursor: nil. "Since we are out of context, reset the cursor." hand keyboardFocus in: [:priorKeyboardFocus | self exclusive ifTrue: [hand newMouseFocus: self]. hand newKeyboardFocus: self. [self isInWorld] whileTrue:[world doOneSubCycle]. hand newKeyboardFocus: priorKeyboardFocus. hand releaseMouseFocus]. ^ result! Item was changed: ----- Method: DialogWindow>>getUserResponseAtHand (in category 'running') ----- getUserResponseAtHand + "Remove unnecessary widgets." + self message ifEmpty: [ messageMorph delete ]. + self paneMorph submorphs ifEmpty: [ self paneMorph delete ]. + "Modal dialogs must be as convenient as possible, put default button directly under hand." + self + ensureSelectedButton ; + preferredPosition: self selectedButton. + ^ self getUserResponse! - - ^ self getUserResponseAtHand: ActiveHand! Item was removed: - ----- Method: DialogWindow>>getUserResponseAtHand: (in category 'running') ----- - getUserResponseAtHand: aHand - - self message ifEmpty: [messageMorph delete]. "Do not waste space." - self paneMorph submorphs ifEmpty: [self paneMorph delete]. "Do not waste space." - - self moveSelectedButtonToHand: aHand. - ^ self getUserResponse! Item was removed: - ----- Method: DialogWindow>>moveSelectedButtonToHand: (in category 'position') ----- - moveSelectedButtonToHand: aHand - "Just let the user confirm the selected button without having to reposition the mouse." - - self ensureSelectedButton. - self moveTo: self fullBounds center + (aHand position - self selectedButton center).! Item was removed: - ----- Method: DialogWindow>>moveTo: (in category 'position') ----- - moveTo: position - - preferredPosition := position.! Item was changed: ----- Method: DialogWindow>>moveToHand: (in category 'position') ----- + moveToHand: aHand + self preferredPosition: aHand position! - moveToHand: aHand - - self moveTo: aHand position.! Item was added: + ----- Method: DialogWindow>>moveToPreferredPosition (in category 'initialization') ----- + moveToPreferredPosition + self center: + (preferredPosition isPoint + ifTrue: [ preferredPosition ] + ifFalse: [ self center + ActiveHand position - preferredPosition center ]). + self bounds: (self bounds translatedToBeWithin: self currentWorld bounds)! Item was added: + ----- Method: DialogWindow>>positionOverWidgetNamed: (in category 'initialization') ----- + positionOverWidgetNamed: nameSymbol + self allMorphsDo: + [ : each | each knownName = nameSymbol ifTrue: [ self preferredPosition: each ] ]! Item was added: + ----- Method: DialogWindow>>preferredPosition: (in category 'position') ----- + preferredPosition: aPointOrMorph + "Specify that the dialog should be positioned at an absolute Point on the screen, or the particular Morph widget which should be positioned under the hand." + preferredPosition := aPointOrMorph! Item was changed: ----- Method: FillInTheBlankMorph class>>request:initialAnswer:centerAt:inWorld:onCancelReturn:acceptOnCR:answerExtent: (in category 'instance creation') ----- request: queryString initialAnswer: defaultAnswer centerAt: aPoint inWorld: aWorld onCancelReturn: returnOnCancel acceptOnCR: acceptBoolean answerExtent: answerExtent "Create an instance of me whose question is queryString with the given initial answer. Invoke it centered at the given point, and answer the string the user accepts. If the user cancels, answer returnOnCancel." "FillInTheBlankMorph request: 'Type something, then type CR.' initialAnswer: 'yo ho ho!!' centerAt: Display center" | aFillInTheBlankMorph | aFillInTheBlankMorph := self new setQuery: queryString initialAnswer: defaultAnswer answerExtent: answerExtent acceptOnCR: acceptBoolean. aFillInTheBlankMorph createAcceptButton action: [aFillInTheBlankMorph textPane accept]. aFillInTheBlankMorph createCancelButton action: [aFillInTheBlankMorph closeDialog: returnOnCancel]. + aFillInTheBlankMorph preferredPosition: aPoint. - aFillInTheBlankMorph moveTo: aPoint. ^ aFillInTheBlankMorph getUserResponse ! Item was changed: ----- Method: FillInTheBlankMorph class>>requestPassword:initialAnswer:centerAt:inWorld:onCancelReturn:acceptOnCR: (in category 'instance creation') ----- requestPassword: queryString initialAnswer: defaultAnswer centerAt: aPoint inWorld: aWorld onCancelReturn: returnOnCancel acceptOnCR: acceptBoolean "Create an instance of me whose question is queryString with the given initial answer. Invoke it centered at the given point, and answer the string the user accepts. If the user cancels, answer returnOnCancel." "FillInTheBlankMorph request: 'Type something, then type CR.' initialAnswer: 'yo ho ho!!' centerAt: Display center" | aFillInTheBlankMorph | aFillInTheBlankMorph := self new setPasswordQuery: queryString initialAnswer: defaultAnswer answerHeight: 50 acceptOnCR: acceptBoolean. aFillInTheBlankMorph createAcceptButton action: [aFillInTheBlankMorph textPane accept]. aFillInTheBlankMorph createCancelButton action: [aFillInTheBlankMorph closeDialog: returnOnCancel]. + aFillInTheBlankMorph preferredPosition: aPoint. - aFillInTheBlankMorph moveTo: aPoint. ^ aFillInTheBlankMorph getUserResponse! Item was added: + ----- Method: PluggableMultiColumnListMorph>>charactersOccluded (in category 'private') ----- + charactersOccluded + "Not meaningful in multi-column lists, since they should truncate their column widths according to how much space is needed vs. available to show a bit of each." + ^ 0! Item was changed: ----- Method: UserDialogBoxMorph class>>confirm:orCancel:title:at: (in category 'utilities') ----- confirm: aString orCancel: cancelBlock title: titleString at: aPointOrNil (self new title: titleString; message: aString; createButton: 'Yes' translated value: true; createButton: 'No' translated value: false; createButton: 'Cancel' translated value: nil; selectedButtonIndex: 1; "YES" registerKeyboardShortcuts; yourself) in: [:dialog | ^ (aPointOrNil ifNil: [dialog getUserResponseAtHand] ifNotNil: [ + dialog preferredPosition: aPointOrNil. - dialog moveTo: aPointOrNil. dialog getUserResponse]) ifNil: [ cancelBlock value ]]! Item was changed: ----- Method: UserDialogBoxMorph class>>confirm:title:trueChoice:falseChoice:at: (in category 'utilities') ----- confirm: aString title: titleString trueChoice: trueChoice falseChoice: falseChoice at: aPointOrNil "UserDialogBoxMorph confirm: 'Make your choice carefully' withCRs title: 'Do you like chocolate?' trueChoice: 'Oh yessir!!' falseChoice: 'Not so much...'" ^self new title: titleString; message: aString; createButton: trueChoice translated value: true; createCancelButton: falseChoice translated value: false; selectedButtonIndex: 1; registerKeyboardShortcuts; + preferredPosition: (aPointOrNil ifNil: [ActiveWorld center]); - moveTo: (aPointOrNil ifNil: [ActiveWorld center]); getUserResponse! Item was changed: ----- Method: UserDialogBoxMorph class>>confirm:title:trueChoice:falseChoice:default:triggerAfter:at: (in category 'utilities') ----- confirm: aString title: titleString trueChoice: trueChoice falseChoice: falseChoice default: default triggerAfter: seconds at: aPointOrNil "UserDialogBoxMorph confirm: 'I like hot java' title: 'What do you say?' trueChoice: 'You bet!!' falseChoice: 'Nope' default: false triggerAfter: 12 at: 121@212" ^self new title: titleString; message: aString; createButton: trueChoice translated value: true; createCancelButton: falseChoice translated value: false; selectedButtonIndex: (default ifTrue: [1] ifFalse: [2]); registerKeyboardShortcuts; + preferredPosition: (aPointOrNil ifNil: [ActiveWorld center]); - moveTo: (aPointOrNil ifNil: [ActiveWorld center]); getUserResponseAfter: seconds! |
Hmm... not sure I agree with your changes. Please elaborate. Also deprecate #getUserResponseAtHand: and not just remove it. You seem to prefer hiding several side effects. How can I now invoke the dialog for a different hand? Where is the API? ;-) In general, I like the idea to extend the dialog to focus on other submorphs of the dialog that are not buttons Best, Marcel
|
Free forum by Nabble | Edit this page |