Attached a simple example (RubTextStuff.st). see the use of the RubTextAccepted announcement (RubTextStuff class>>example) to do things when the code is accepted in the view. now you can also have a look at RubMethodEditingExample when the selector change, then the code in the text view is changed: selector: aSymbol selector := aSymbol ifNotNil: [:sel |( sel copyWithout: Character cr) asSymbol]. self updateCodeWith: ''. self changed: #selector. self classToUse ifNotNil: [:cls | (cls selectors includes: selector) ifTrue: [self updateCodeWith: (cls sourceCodeAt: selector)]] updateCodeWith: someText. self textModel setText: someText. Cheers Alain
On 12 mai 2015, at 17:14, stepharo <stepharo@free.fr> wrote:
We tried all kind of combinations....
modelEditor := (RubSmalltalkMethodEditorModel new client: self). widget := modelEditor newScrolledText.
widget on: self text: #sourceCodeFrom: accept: #compileSource:notifying: readSelection: #contentsSelectionFrom: menu: #sourceCodeMenu:shifted:.
self addDependent: modelEditor. self when: #sourceCodeFrom: send: #setText: to: modelEditor.
widget beWrapped; beForSmalltalkCode; withLineNumbers; setText: self sourceCode; setTextSelector: #halt. ^ widget
But we cannot get the editor or the widget to be invoked when the list changes. So we spent three hours on it so we should stop. We are missing just this bit.
Stef