pharo-graphics / Toplo

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

Creating a ToButton with a background doesn't apply the background #157

Open Eliott-Guevel opened 2 weeks ago

Eliott-Guevel commented 2 weeks ago

Applying a background to a ToButton then adding it to a BlSpace doesn't apply it. It does apply it in the BlSpace preview though.

buttonBackground

To reproduce:

aSpace := BlSpace new
    position: 50 asPoint;
    show; 
    yourself.

button := ToButton new 
    labelText: 'Button';
    size: 100 @ 100;
    background: Color red.

aSpace root addChild: button

Also does it in this order:

    size: 100 @ 100.

aSpace root addChild: button.
button background: Color red.

Currently, the method must be executed after the window is shown. Instead, it would be better if executing the displayed code changed its background.

plantec commented 2 weeks ago

Toplo widgets look are managed by a skin. If you don't want to use the default skin then send #withNullSkin to the button. But don't expect it to adapt itself when hovered, leaved, pressed, ... other solutions are to define you own skin/theme or to not use Toplo button.

aSpace := BlSpace new
    position: 50 asPoint;
    show; 
    yourself.

button := ToButton new withNullSkin;
    labelText: 'Button';
    size: 100 @ 100;
    background: Color red.

aSpace root addChild: button