pharo-spec / Spec

Spec is a framework in Pharo for describing user interfaces.
MIT License
61 stars 63 forks source link

Missing method on SpAbstractWidgetPresenter to update the visual state that depends on the enabled block #1561

Open koendehondt opened 2 weeks ago

koendehondt commented 2 weeks ago

See #1559.

Given that SpAbstractWidgetPresenter>>#enabled: can take a block:

enabled: aBooleanOrValuable
    "Set if the widget is enabled (clickable or focusable).
    This can either be a boolean or a block returning a boolean."

    enabled := aBooleanOrValuable

as in:

presenter := SpPresenter new.
button := SpButtonPresenter new
    icon: (presenter iconNamed: #smallSave);
    enabled: [ false ];
    action: [ "do something" ];
    yourself.
presenter layout: (SpBoxLayout newLeftToRight
    add: button;
    yourself).
presenter open

SpAbstractWidgetPresenter should have a method, e.g. refresh, to update the visual state of an instance, so that the condition in the enabled block is evaluated again.

Ducasse commented 2 weeks ago

Koen I thought about introducing a tag for book. What do you think? Like that we can help esteban knowing that this is important for the book.

koendehondt commented 2 weeks ago

Very good idea.

On 19 Jun 2024, at 07:40, StéphaneDucasse @.***> wrote:

Koen I thought about introducing a tag for book. What do you think? Like that we can help esteban knowing that this is important for the book.

— Reply to this email directly, view it on GitHub https://github.com/pharo-spec/Spec/issues/1561#issuecomment-2177790619, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFX457XF7THBIPY2NW4UFLZIEKVTAVCNFSM6AAAAABJQ2ZKZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZXG44TANRRHE. You are receiving this because you authored the thread.