This code should give you a clue of how to do what you want. You can file it in or type it in yourself. You can run it from the playground with the command -
SimpleExample new openWithSpec. How it works - You need to subclass SpPresenter. You need to set up an instance method called initializePresenters to create a text input and a button. You then create aninstance method called connectPresenters to put a handler on to the button. You need a class side method called defaultSpec to layout the button and the text input That's it. Note that you have to hit enter to register any change in the text field. You will need the transcript open to see the results in this example. Hope this helps SpPresenter subclass: #SimpleExample instanceVariableNames: 'myButton myTextField' classVariableNames: '' package: 'KMP-SimpleSpecExample'! !SimpleExample methodsFor: 'as yet unclassified' stamp: 'KMP 7/28/2020 16:20'! initialize super initialize ! ! !SimpleExample methodsFor: 'initialization' stamp: 'KMP 7/28/2020 16:31'! initializePresenters myButton := self newButton . myButton label:'Click Me'. myTextField := self newTextInput. ! ! !SimpleExample methodsFor: 'initialization' stamp: 'KMP 7/28/2020 16:29'! connectPresenters "Put what you want to do when the button is clicked hhere" myButton whenActivatedDo: [ Transcript show: myTextField text].! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! SimpleExample class instanceVariableNames: ''! !SimpleExample class methodsFor: 'specs' stamp: 'KMP 7/28/2020 16:30'! defaultSpec ^ SpBoxLayout newVertical borderWidth: 10; spacing: 10; add: #myTextField expand: false; add: #myButton expand: false; yourself! ! -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html