Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bind a LabelMorph/TextMorph to a variable so that the Morph reflects changes of the variable?

  • I have an object with a variable containing a String.
  • I have a window containing a LabelMorph/TextMorph (or some other Morph that displays Text?).

How do i bind the LabelMorph/TextMorph to the variable, so that the label updates when the String in the variable changes?

  • classic Smalltalk-80 dependent/change/update mechanism?
  • Pharo Announcement framework?
  • something different??

How would i do this? Which Morph should i use?

like image 285
MartinW Avatar asked Dec 26 '22 07:12

MartinW


1 Answers

Simplest is to use an updating String morph:

UpdatingStringMorph on: self selector: #myLabel

This will send #myLabel (or any other message) to self (or any other object) and display it.

like image 105
Vanessa Freudenberg Avatar answered Mar 05 '23 18:03

Vanessa Freudenberg