pharo-graphics / Toplo

A widget framework on top of Bloc
MIT License
17 stars 8 forks source link

To discuss: When text are changed they do not automaticly reapply the skin #146

Open Nyan11 opened 1 month ago

Nyan11 commented 1 month ago

Hello,

I had a discussion about automatically reapplying the skin after changing the text of an element. In example1 i present an example of a code where the skin are not reapply. In example2, i present the current solution to force the reapplication of the skin.

The discution

Developper A say: when you change the text of a label or a button, the skin should automatically be reapply. The usefull information of a ropped text is the string it contains.

Developper B say: when you change any properties of an element you do not want the skin to be reapply. It should be the same for the RoppedText.

I think the ropped text has 2 functions:

example1

label := ToLabel new text: 'hello world'; addStamp: #danger; position: 0@50; yourself.
button := ToButton new labelText: 'Change the label'; addEventHandlerOn: BlClickEvent do: [ label text: 'goodBye' ]; yourself. 

space := BlSpace new.
space root addChild: button.
space root addChild: label.
space show.

space toTheme: ToBeeThemeGenerated new.

When i do it the upper code in a playground i obtain the folowing picture: image

If i click 2 times on the button i obtain the following picture: image

We saw in this example that the skin is not reapply to the ropped text inside the label and the button. The text should be red for the label and white for the button.

example2

labelToChange := ToLabel new text: 'hello world'; addStamp: #danger; position: 0@50; yourself.
buttonToChange := ToButton new labelText: 'hello world'; addStamp: #primary; position: 100 @ 50; yourself.
button := ToButton new
    labelText: 'Change the label';
    addEventHandlerOn: BlClickEvent do: [ 
        labelToChange text: 'goodbye sky'; requestNewSkin.
        buttonToChange labelText: 'goodbye sky'; requestNewSkin .
        ];
    yourself. 

space := BlSpace new.
space root addChild: button.
space root addChild: labelToChange.
space root addChild: buttonToChange.
space show.

space toTheme: ToBeeThemeGenerated new.
plantec commented 1 month ago

the skin should be reapplied when the text is changed