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:
It is the model of what you want to display and therefore should be updated by the style sheet (like adding a new element).
It is the model of how you want to display it and therefore in conflict with the style sheet (like changing a property after the installation phase of a skin).
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:
If i click 2 times on the button i obtain the following picture:
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.
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
When i do it the upper code in a playground i obtain the folowing picture:![image](https://github.com/pharo-graphics/Toplo/assets/34318678/34a90165-5594-4225-bdfc-c63ccda18798)
If i click 2 times on the button i obtain the following picture:![image](https://github.com/pharo-graphics/Toplo/assets/34318678/f3211497-f88e-47eb-9cd7-aa67b892a69f)
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