如何将 Smalltalk 代码编辑器嵌入到我的应用程序中?
我正在 Pharo 图像中构建博客条目查看器和编辑器应用程序,条目内容的格式为 Smalltalk 代码(Seaside 标记 API 非常好)。我对 Smalltalk 还很陌生,所以我使用了 这篇博文 为例。
我目前的 BlogEditor>>open
方法有这个:
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
我不知道用什么来代替 editor := builder newTextEditorFor:
。我看到了 SmalltalkEditor
类,但我不知道如何将其放在我的 UI 上。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将行放在
下面
运行代码 。当它停止时,调试并选择构建器。浏览它以查看还可以添加哪些内容。
您知道 Pharo 中的文本有格式吗?只需浏览文本即可。
Put the line
below
Run the code. When it halts, debug and select the builder. Browse it to see what else you can add.
You do know a Text in Pharo has formatting? Just browse Text.
可以使用的是 PluggableTextMorph,它引用 TextMorphForEditView,而 TextMorphForEditView 又为您提供了 SmalltalkEditor。
PluggableTextMorph 是一个 ScrollPane
您还可以查看 TextMorph,它会很方便。
UITheme 构建器隐藏了所有令人讨厌的细节,但它会让您回到上面提到的类。
祝你好运。
What can be used is a PluggableTextMorph, which refers to a TextMorphForEditView, which in turn gives you a SmalltalkEditor.
PluggableTextMorph is a ScrollPane
You can also look in the TextMorph which could come handy.
The UITheme builder hides all of the nasty details inside but it will bring you back to the classes mentioned above.
Good luck.