Hi all,
It used to be that you can return a formatted Text from the method designated via the label selector of a pluggable tree. This screenshot is from Squeak 5.2: In Trunk, this is broken. With the same code, the node labels are always unformatted, (except for the highlight color, which is used in ObjectExplorer, for example): In case it was never supposed to work like that, how can I have Text-formatted labels in a pluggable tree in a supported way? Kind regards, Jakob Code excerpts for reference:
|
Hi Jakob, how do you set the formatting? See: SimpleHIerarchicalListMorph >> #addMorphsTo:from:... SimpleHIerarchicalListMorph >> #font IndentingListItemMorph (StringMorph) >> #font: IndentingListItemMorph (StringMorph) >> #fontToUse ListItemWrapper >> #asString ...I don't see any support for item-specific text attributes such as the font emphasis. Sorry. There has been a discussion about #preferredColor though: Best, Marcel
|
I also didn't find how it came to be when I had a brief look at the classes involved with the tree some weeks ago. Yet it used to work and now it doesn't. Originally I wanted to investigate and compare with Squeak 5.2 further, but unfortunately I won't have the time these weeks. Am Sa., 12. Okt. 2019 um 10:20 Uhr schrieb Marcel Taeumel <[hidden email]>:
|
Sorry I misread your question, "how do you *set* the formatting?"... The pluggable tree has a configurable selector to obtain the labels of the nodes. You set it with PluggableTreeSpec>>#label:. I simply returned a Text with formatting from the model's method for the label, as indicated below my first mail. How it worked that the formatting was visible, I don't know. Am Sa., 12. Okt. 2019 um 11:19 Uhr schrieb Jakob Reschke <[hidden email]>:
|
Debugging this now: 0. The drawn items are IndentingListItemMorphs, which inherit from StringMorph. 1. The emphasis var of the IndentingListItemMorph is set to 1 in 5.2, but to 0 (default) in Trunk, after the item is initialized with the Text from the model. 2. StringMorph>>initWithContents:font:emphasis: uses the contents: setter in 5.2, but sets the instance variable directly in Trunk. 3. The emphasis is used in StringMorph>>fontToUse to look up a derivative font, with bold setting in my case. So in 5.2 the IndentingListItemMorph contents is a String and the emphasis code is aligned with the emphasis of the first character in the Text label. In Trunk, contents is the Text label itself (and its formatting is not used) and the emphasis code is not set in accordance with the Text. @Marcel: you changed the init method on 2019-08-30. Is it possible to restore the previous behavior and still keep your functional fixes? This is the Monticello version: Name: Morphic-mt.1512 Author: mt Time: 2 September 2019, 7:59:55.139688 am UUID: 1feb80dc-74d2-2948-a7a1-0192335930f0 Ancestors: Morphic-mt.1511 Clean up StringMorph-related code which also moves some methods from MorphicExtras and Etoys back to Morphic such as #fullPrintOn: - Clean up font+emphasis behavior in StringMorph; not that StringMorphs keep existing emphasis when a new font is set. - MenuItemMorph did strange overrides of #hResizing and #vResizing -- I suppose a performance hack from the old days - No need for UpdatingStringMorph to duplicate implementation for #contents: anymore - Adds StringMorph >> #contentsFitted: (default) besides #contentsClipped: to make these options more clear |
Hi Jakob, yes, the formatting of the first (text) character should be used for the entire (StringMorph) item just as it works in PluggableListMorphs. I will have a look at it. Best, Marcel
|
Hi Jakob, should work again in Morphic-mt.1594. Best, Marcel
|
Free forum by Nabble | Edit this page |