Modify Dynamic Content Smalltalk Pharo TextMorph

Is there a way to get TextMorph added to StandardWindow in Pharo and then change its contents?

+4
source share
1 answer

You can get the content SystemWindowor its subclass a StandardWindowby sending it a message paneMorphsor paneMorphSatisfying:.

You can set the contents of TextMorph with - contents::)

Rate this example by the lines in the workspace or playground and observe the text in the window:

| textMorph text1 text2 window |
textMorph := TextMorph new.
text1 := 'Smalltalk is cool' asText.
text2 := 'Pharo is cool' asText.
textMorph contents: text1.
window := textMorph openInWindow.
window paneMorphs first contents: text2.

Here we have only one paneMorph, textMorph. In a more complex layout, you must first select the correct panel. Or you would save the link to your textMorph in the first place, and you would not need to extract it from the window ...

+4
source

Source: https://habr.com/ru/post/1599613/


All Articles