Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1234.mcz==================== Summary ====================
Name: Morphic-mt.1234
Author: mt
Time: 5 August 2016, 9:50:39.938358 am
UUID: f9e6aac9-cfa2-2a45-b4e8-7af937d0d306
Ancestors: Morphic-mt.1233
Due to popular request, provide support for dialogs to behave more like pop-up menus, that is, dismiss them if you click outside their bounds.
=============== Diff against Morphic-mt.1233 ===============
Item was changed:
Morph subclass: #DialogWindow
+ instanceVariableNames: 'titleMorph messageMorph paneMorph buttonRow result selectedButton cancelButton timeout preferredPosition keyMap exclusive filter filterEnabled filterMorph autoCancel'
- instanceVariableNames: 'titleMorph messageMorph paneMorph buttonRow result selectedButton cancelButton timeout preferredPosition keyMap exclusive filter filterEnabled filterMorph'
classVariableNames: 'GradientDialog RoundedDialogCorners UseWiggleAnimation'
poolDictionaries: ''
category: 'Morphic-Windows'!
!DialogWindow commentStamp: '<historical>' prior: 0!
A DialogBoxMorph is Morph used in simple yes/no/confirm dialogs. Strongly modal.!
Item was added:
+ ----- Method: DialogWindow>>autoCancel (in category 'accessing') -----
+ autoCancel
+ "Whether to automatically cancel and close this dialog if the user clicks outside it. Like dismissing a pop-up menu."
+
+ ^ autoCancel!
Item was added:
+ ----- Method: DialogWindow>>autoCancel: (in category 'accessing') -----
+ autoCancel: aBoolean
+
+ autoCancel := aBoolean.!
Item was changed:
----- Method: DialogWindow>>initialize (in category 'initialization') -----
initialize
super initialize.
self
changeTableLayout;
listDirection: #topToBottom;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
setProperty: #indicateKeyboardFocus toValue: #never.
self createTitle: 'Dialog'.
self createBody.
self setDefaultParameters.
keyMap := Dictionary new.
exclusive := true.
+ autoCancel := false.
preferredPosition := ActiveWorld center.!
Item was changed:
----- Method: DialogWindow>>mouseDown: (in category 'events') -----
mouseDown: event
self stopAutoTrigger.
"Always bring me to the front since I am modal"
self comeToFront.
+ (self containsPoint: event position) ifFalse: [
+ ^ self autoCancel
+ ifTrue: [self cancelDialog]
+ ifFalse: [self flash]].
- (self containsPoint: event position)
- ifFalse:[^ self flash].
event hand
waitForClicksOrDrag: self
event: event
selectors: { nil. nil. nil. #startDrag: }
threshold: HandMorph dragThreshold.!