in general this is not a good style to set color directly.
Using style will make sure that your components will support themes in a 
simpler way. 
Because you will not have to have case statements and check all the place where 
you change color.

S

> On 12 Mar 2022, at 15:53, Robert Briggs via Pharo-users 
> <pharo-users@lists.pharo.org> wrote:
> 
>  
> Thanks Esteban
>  
> I’ve made it work based on your example.  As you said I didn’t need 
> registerEvents.  My original block just called a method that I used for 
> trapping with the debugger to investigate how it worked.
>  
> One question.  Why can I not simply send borderColor: #red to the presenter 
> rather than using the stylesheet method?
>  
> Regards
> Robert
>  
> From: Esteban Lorenzano <esteba...@netc.eu <mailto:esteba...@netc.eu>>
> Reply to: Any question about pharo is welcome <pharo-users@lists.pharo.org 
> <mailto:pharo-users@lists.pharo.org>>
> Date: Saturday, 12 March 2022 at 13:28
> To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
> Cc: Robert Briggs <rbriggs2...@me.com>
> Subject: [Pharo-users] Re: Detecting keystrokes in Spec2 input fields
>  
> 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 
> <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.oster...@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

Reply via email to