Delayed preference color updating

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Delayed preference color updating

Karl Ramberg
I have a issue with non modal color changing.
The NewColorPicker is not modal and the method returns a value before the user click 'close' button in NewColorPicker.
How can I change behavior to update color when the button is clicked?
 
PBColorPreferenceView>>changeColor: aButton
aButton changeColor. "returns the current color when not modal"
self preference preferenceValue: aButton fillStyle.
button label: self preference preferenceValue asString.
self adjustLabelColor

Best,
Karl


Reply | Threaded
Open this post in threaded view
|

Re: Delayed preference color updating

marcel.taeumel
Hi Karl.

I like it the non-modal way. It feels more immediate/direct. The button "close" does not suggest a "save operation." If we would make it modal, we would have to add another button to have "Save" and "Cancel".

I don't like the way that the button/morph is used as a value holder for the color because we rely on that the button does not modify the color internally.

To solve this problem, I would rather directly invoke the color picker in PBColorPreferenceView >> #changeColor:. For the new color picker, I would add some processing block for the target as an alternative to the hard-coded #color: message send. Like this:

(NewColorPickerMorph with: [:newColor |
   aButton color: newColor.
   self preference preferenceValue: newColor.
   aButton label: newColor asString.
   self adjustLabelColor]) openInWorld.

The color picker can evaluate the block with the new color as needed. The block closures the button and the preference view.

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: Delayed preference color updating

Karl Ramberg
Hi,
Thanks for reply.
I was thinking of using a block, but I was unsure how to use it :-)
I will see what I can come up with. 
The functionality must work according to what color picker i selected in the preference for color picker also ;-)

Happy new year

Best,
Karl

On Fri, Jan 1, 2016 at 2:43 PM, marcel.taeumel <[hidden email]> wrote:
Hi Karl.

I like it the non-modal way. It feels more immediate/direct. The button
"close" does not suggest a "save operation." If we would make it modal, we
would have to add another button to have "Save" and "Cancel".

I don't like the way that the button/morph is used as a value holder for the
color because we rely on that the button does not modify the color
internally.

To solve this problem, I would rather directly invoke the color picker in
PBColorPreferenceView >> #changeColor:. For the new color picker, I would
add some processing block for the target as an alternative to the hard-coded
#color: message send. Like this:

(NewColorPickerMorph with: [:newColor |
   aButton color: newColor.
   self preference preferenceValue: newColor.
   aButton label: newColor asString.
   self adjustLabelColor]) openInWorld.

The color picker can evaluate the block with the new color as needed. The
block closures the button and the preference view.

Best,
Marcel



--
View this message in context: http://forum.world.st/Delayed-preference-color-updating-tp4868940p4868960.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.




Reply | Threaded
Open this post in threaded view
|

Re: Delayed preference color updating

marcel.taeumel
Well, I think there is a trade-off and you might want to just duplicate the code from Morph >> #changeColor into PBColorPreferenceView >> #changeColor: to call the different versions of color picker accordingly.

I guess there is no need to over-engineer something here. Maybe we should get rid of the old color picker and add a "modal mode" for the the new one.

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: Delayed preference color updating

Karl Ramberg
The new color picker i mostly nice. 
That you can not pick up colors outside of it is not good.



I'm not successful in writing this code though. 
I can not get the block to work like I want to...

Best,
Karl

On Fri, Jan 1, 2016 at 9:23 PM, marcel.taeumel <[hidden email]> wrote:
Well, I think there is a trade-off and you might want to just duplicate the
code from Morph >> #changeColor into PBColorPreferenceView >> #changeColor:
to call the different versions of color picker accordingly.

I guess there is no need to over-engineer something here. Maybe we should
get rid of the old color picker and add a "modal mode" for the the new one.

Best,
Marcel



--
View this message in context: http://forum.world.st/Delayed-preference-color-updating-tp4868940p4868982.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.