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.
Put the line
self halt.
below
builder := UITheme builder.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With