[Pkg] The Trunk: ToolBuilder-Morphic-mt.180.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Aug 5 07:50:09 UTC 2016


Marcel Taeumel uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-mt.180.mcz

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

Name: ToolBuilder-Morphic-mt.180
Author: mt
Time: 5 August 2016, 9:50:02.050358 am
UUID: 31288670-0ff0-cd4f-9ef3-ca5b88c2fe00
Ancestors: ToolBuilder-Morphic-mt.179

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.

Apply this pop-up-menu behavior to all list-choosing dialogs.

=============== Diff against ToolBuilder-Morphic-mt.179 ===============

Item was changed:
  ----- Method: ListChooser>>buildWith: (in category 'building') -----
  buildWith: builder
  
  	| dialogSpec searchBarHeight listSpec fieldSpec |
  	
  	searchBarHeight := Preferences standardDefaultTextFont height * 2.
  	
  	dialogSpec := builder pluggableDialogSpec new
  		model: self;
  		title: #title;
  		closeAction: #closed;
  		extent: self initialExtent;
+ 		autoCancel: true; "behave like a pop-up menu"
  		children: OrderedCollection new;
  		buttons: OrderedCollection new;
  		yourself.
  	
  	listSpec := builder pluggableListSpec new.
  	listSpec 
  		model: self;
  		list: #items; 
  		getIndex: #selectedIndex; 
  		setIndex: #selectedIndex:; 
  		doubleClick: #accept;
  		"keystrokePreview: #keyStrokeFromList:;"
  		autoDeselect: false;
  		name: #list;
  		frame: (LayoutFrame fractions: (0 at 0 corner: 1 at 1) offsets: (0 at searchBarHeight corner: 0 at 0)).
  	dialogSpec children add: listSpec.
  	
  	fieldSpec := builder pluggableInputFieldSpec new.
  	fieldSpec 
  		model: self;
  		getText: #searchText;
  		editText: #searchText:;
  		setText: #acceptText:;
  		selection: #textSelection;
  		menu: nil;
  		indicateUnacceptedChanges: false;
  		askBeforeDiscardingEdits: false;
  		help: 'Type a string to filter down the listed items';
  		frame: (LayoutFrame fractions: (0 at 0 corner: 1 at 0) offsets: (0 at 0 corner: 0 at searchBarHeight)).
  	dialogSpec children add: fieldSpec.
  	
  	"Buttons"
  	dialogSpec buttons add: (
  		builder pluggableButtonSpec new
  			model: self; 
  			label: #acceptLabel;
  			action: #accept;
  			enabled: #canAcceptOrAdd;
  			color: #acceptColor).
  
  	dialogSpec buttons add: (
  		builder pluggableButtonSpec new
  			model: self; 
  			label: 'Cancel';
  			action: #cancel;
  			color: #cancelColor).
  		
  	dialogMorph := builder build: dialogSpec.
  	dialogMorph addKeyboardCaptureFilter: self.
  	listMorph := builder widgetAt: #list.
  	listMorph allowEmptyFilterResult: true.
  	
  	^ dialogMorph!

Item was changed:
  ----- Method: MorphicToolBuilder>>buildPluggableDialog: (in category 'widgets optional') -----
  buildPluggableDialog: aSpec
  
  	| widget |
  
  	widget := self dialogClass new.
  	self register: widget id: aSpec name.
  	
  	widget model: aSpec model.
  
  	"Set child dependent layout properties. The pane morph holds the special contents."
  	widget paneMorph wantsPaneSplitters: (aSpec wantsResizeHandles ifNil: [true]).
  	self setLayoutHintsFor: widget paneMorph spec: aSpec.
  	widget paneMorph layoutInset: (aSpec padding ifNil: [ProportionalSplitterMorph gripThickness]).
  	widget paneMorph cellInset: (aSpec spacing ifNil: [ProportionalSplitterMorph gripThickness]).
  	widget paneMorph wantsPaneSplitters ifTrue: [widget paneMorph addCornerGrips"addEdgeGrips"].
  
  	"Now create the children."
  	panes := OrderedCollection new.
  	aSpec children isSymbol
  		ifTrue: [
  			widget getChildrenSelector: aSpec children.
  			widget update: aSpec children]
  		ifFalse: [
  			self buildAll: aSpec children in: widget paneMorph].
  
  	"Now create the buttons."
  	aSpec buttons isSymbol
  		ifTrue: [
  			widget getButtonsSelector: aSpec buttons.
  			widget update: aSpec buttons]
  		ifFalse: [
  			self buildAll: aSpec buttons in: widget buttonRowMorph.
  			widget updateButtonProperties].
  
  	aSpec title ifNotNil: [:label |
  		label isSymbol 
  			ifTrue:[widget getTitleSelector: label; update: label]
  			ifFalse:[widget title: label]].
  	aSpec message ifNotNil: [:label |
  		label isSymbol 
  			ifTrue:[widget getMessageSelector: label; update: label]
  			ifFalse:[widget message: label]].
+ 	
+ 	"Interaction behavior."
+ 	aSpec autoCancel ifNotNil: [:b | widget autoCancel: b].
+ 	aSpec exclusive ifNotNil: [:b | widget exclusive: b].
  		
  	widget closeDialogSelector: aSpec closeAction.
  	self buildHelpFor: widget spec: aSpec. 
  
  	"Everything is shrink-wrapped around the pane morph."
  	widget paneMorph extent: (aSpec extent ifNil:[widget initialExtent]).
  
  	^ widget!

Item was changed:
  ----- Method: MorphicUIManager>>chooseFrom:lines:title: (in category 'ui requests') -----
  chooseFrom: aList lines: linesArray title: aString 
  	"Choose an item from the given list. Answer the index of the selected item."
  	
  	aList size <= 7 ifTrue: [
  		| dialog |
  		dialog := DialogWindow new
  			title: 'Please Choose';
  			message: aString;
  			filterEnabled: true;
+ 			autoCancel: true;
  			yourself.
  		aList doWithIndex: [:ea :index |
  			dialog createButton: ea value: index].
  		dialog selectedButtonIndex: 1.
  		^ dialog getUserResponseAtHand ifNil: [0]].
  	
  	^ ListChooser chooseFrom: aList title: aString!



More information about the Packages mailing list