Hi, no, you don't need to send any "registerEvents". This is internal and is sent on initialize, when you create the presenter. precisely last week I make an example of what you are asking for: https://github.com/pharo-spec/Spec-QA/blob/main/qa005.md cheers! Esteban On Mar 12 2022, at 2:20 pm, Robert Briggs via Pharo-users <pharo-users@lists.pharo.org> wrote:
Hi Kasper
Problem solved. Iâve done some more experimenting and it seems that registerEvents needs to be sent to make whenTextChangedDo: active. Makes sense but havenât seen it documented anywhere.
Regards Robert
From: Kasper Osterbye <kasper.osterbye@gmail.com> Reply to: Any question about pharo is welcome <pharo-users@lists.pharo.org> Date: Saturday, 12 March 2022 at 10:31 To: Any question about pharo is welcome <pharo-users@lists.pharo.org> Subject: [Pharo-users] Re: Detecting keystrokes in Spec2 input fields
If it is in the TextPresenter you might be looking for
whenTextChangedDo: or whenSubmitDo: Both inherited from SpAbstractTextPresenter
Best,
Kasper
On 12 Mar 2022, at 11.26, Robert Briggs via Pharo-users <pharo-users@lists.pharo.org (mailto:pharo-users@lists.pharo.org)> wrote:
Hi
Is there a simple way to detect when a use makes a keystroke in for example a Spec 2 Text Input Presenter?
Iâve been going through all the relevant classes and methods, even into Morphic, but so far I have not found a way to do it.
I want to be able to identify when unaccepted changes have been made to the displayed text to ensure that a use does not leave a form without saving any input made.
Regards
Robert