5

I'm building a blog entry viewer and editor application in my Pharo image, and the entry content is formatted as Smalltalk code (the Seaside markup API is really nice). I'm pretty new to Smalltalk, so I was using this blog post as an example.

I currently have this for my BlogEditor>>open method:

open
| builder content |

builder := UITheme builder.
content := builder newColumn: {
    builder newRow: {
        builder newListFor: self
        list: #entries 
        selected: #entrySelectedIndex
        changeSelected: #entrySelectedIndex:
        help: 'Blog entries'.
    }.
    builder newRow: {
        editor := builder
            newTextEditorFor: self
            getText: #readSelectedEntry
            setText: #changeSelectedEntry:.
        editor minHeight: 400 } }.

(content openInWindowLabeled: 'Entries') extent: 800@700

I don't know what to put in place of editor := builder newTextEditorFor:. I saw the class SmalltalkEditor, but I don't know how to put one on my UI.

4

2 回答 2

1

可以使用的是 PluggableTextMorph,它指的是 TextMorphForEditView,它反过来给你一个 SmalltalkEditor。

PluggableTextMorph 是一个 ScrollPane

您还可以查看可能派上用场的 TextMorph。

UITheme 构建器隐藏了所有令人讨厌的细节,但它会让你回到上面提到的类。

祝你好运。

于 2013-03-12T23:53:01.587 回答
1

放线

self halt.

以下

builder := UITheme builder.

运行代码。当它停止时,调试并选择构建器。浏览它以查看您还可以添加什么。

你知道 Pharo 中的文本有格式吗?只需浏览文本。

于 2011-03-01T07:53:10.097 回答