Marcel Taeumel uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-mt.182.mcz ==================== Summary ==================== Name: ToolBuilder-Morphic-mt.182 Author: mt Time: 10 August 2016, 3:00:05.021966 pm UUID: cf32bef0-feca-0341-985c-eb899238a466 Ancestors: ToolBuilder-Morphic-mt.181 If "filterable lists" is disabled, there has to be a way to force it, for example, for our ListChooser. Otherwise the ListChoose would behave strangely. =============== Diff against ToolBuilder-Morphic-mt.181 =============== 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; + filterableList: true; name: #list; frame: (LayoutFrame fractions: (0@0 corner: 1@1) offsets: (0@searchBarHeight corner: 0@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: (self addAllowed ifTrue: ['Type new or filter existing...' translated] ifFalse: ['Type to filter existing...' translated]); frame: (LayoutFrame fractions: (0@0 corner: 1@0) offsets: (0@0 corner: 0@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>>buildPluggableList: (in category 'widgets required') ----- buildPluggableList: aSpec | widget listClass getIndex setIndex | aSpec getSelected ifNil:[ listClass := self listClass. getIndex := aSpec getIndex. setIndex := aSpec setIndex. ] ifNotNil:[ listClass := self listByItemClass. getIndex := aSpec getSelected. setIndex := aSpec setSelected. ]. widget := listClass on: aSpec model list: aSpec list selected: getIndex changeSelected: setIndex menu: aSpec menu keystroke: aSpec keyPress. self register: widget id: aSpec name. "Override default scroll bar policies if needed. Widget will use preference values otherwise." aSpec hScrollBarPolicy ifNotNil: [:policy | policy caseOf: { [#always] -> [widget alwaysShowHScrollBar]. [#never] -> [widget hideHScrollBarIndefinitely]. [#whenNeeded] -> [widget showHScrollBarOnlyWhenNeeded]. } ]. aSpec vScrollBarPolicy ifNotNil: [:policy | policy caseOf: { [#always] -> [widget alwaysShowVScrollBar]. [#never] -> [widget hideVScrollBarIndefinitely]. [#whenNeeded] -> [widget showVScrollBarOnlyWhenNeeded]. } ]. widget getListElementSelector: aSpec listItem. widget getListSizeSelector: aSpec listSize. widget getIconSelector: aSpec icon. widget getHelpSelector: aSpec helpItem. widget doubleClickSelector: aSpec doubleClick. widget dragItemSelector: aSpec dragItem. widget dropItemSelector: aSpec dropItem. widget wantsDropSelector: aSpec dropAccept. widget dragStartedSelector: aSpec dragStarted. widget autoDeselect: aSpec autoDeselect. widget keystrokePreviewSelector: aSpec keystrokePreview. + aSpec filterableList ifNotNil: [:b | widget filterableList: b]. + aSpec color ifNotNil: [:c | widget color: c]. self buildHelpFor: widget spec: aSpec. self setFrame: aSpec frame in: widget. self setLayoutHintsFor: widget spec: aSpec. parent ifNotNil:[self add: widget to: parent]. panes ifNotNil:[ aSpec list ifNotNil:[panes add: aSpec list]. ]. ^widget! |
Free forum by Nabble | Edit this page |