# HG changeset patch # User Jan Vrany # Date 1516967004 0 # Node ID 232954e959f70d6cdb64f5bd2df5833f0870121a # Parent c6976b98f3c370b4f06146d5398371767462d814 Fixed `PopUpList` widget to display correctly non-string objects ...using their `#displayOn:x:y:` / or `#displayString`. The popup menu shown the `#displayString` correctly however the "button" stubbornly used object's `#printString`, making the widget largely unusable with anything but strings. This commit removes this limitation. diff -r c6976b98f3c3 -r 232954e959f7 PopUpList.st --- a/PopUpList.st Wed Oct 11 23:37:38 2017 +0100 +++ b/PopUpList.st Fri Jan 26 11:43:24 2018 +0000 @@ -568,7 +568,7 @@ index == 0 ifTrue:[ newLabel := defaultLabel ] ifFalse:[ - newLabel := (menuLabels at:index) printString + newLabel := (menuLabels at:index) ]. "kludge: don't want label to resize ..." @@ -596,7 +596,8 @@ p open " - "Modified: / 29.10.1997 / 15:50:12 / cg" + "Modified: / 29-10-1997 / 15:50:12 / cg" + "Modified: / 26-01-2018 / 10:10:56 / Jan Vrany " ! values:aList @@ -1010,7 +1011,7 @@ rawLabelSizeOf:aLogo "compute the extent needed to hold the label plus the mark" - |ext mmH mmV longest longestWidth labels deviceFont| + |ext mmH mmV longest longestWidth labels| ext := super rawLabelSizeOf:aLogo. @@ -1019,26 +1020,25 @@ and:[adjust ~~ #center]]) ifTrue:[ "compute length of longest menu entry" - deviceFont := gc deviceFont. longest := logo. logo isNil ifTrue:[ longestWidth := 0 ] ifFalse:[ - longestWidth := deviceFont widthOf:logo. + longestWidth := super rawLabelSizeOf: logo. ]. labels := menu value labels. labels notNil ifTrue:[ labels do:[:entry | |this| - this := deviceFont widthOf:entry printString. + this := super rawLabelSizeOf: entry. this > longestWidth ifTrue:[ longest := entry. longestWidth := this ]. ]. ]. - ext := ext max:(super rawLabelSizeOf:(longest printString)) + ext := ext max:(super rawLabelSizeOf:(longest displayString)) ]. showHandle ifTrue:[ @@ -1050,7 +1050,8 @@ ]. ^ ext - "Modified: / 6.3.1999 / 21:51:14 / cg" + "Modified: / 06-03-1999 / 21:51:14 / cg" + "Modified: / 26-01-2018 / 10:11:36 / Jan Vrany " ! ! !PopUpList methodsFor:'private-controller access'! @@ -1112,7 +1113,7 @@ "/ self sizeFixed:true. label := menuLabels at:anIndex. - super label:label printString suppressResize:true. + super label:label suppressResize:true. "/ ]. (model notNil and:[changeMsg notNil]) ifTrue:[ @@ -1147,7 +1148,8 @@ menuAction value:value. ]. - "Modified: / 29.10.1997 / 21:08:50 / cg" + "Modified: / 29-10-1997 / 21:08:50 / cg" + "Modified: / 26-01-2018 / 10:10:38 / Jan Vrany " ! ! !PopUpList class methodsFor:'documentation'! @@ -1158,5 +1160,10 @@ version_CVS ^ '$Header$' +! + +version_HG + + ^ '$Changeset: $' ! !