Spec icon indicating copy to clipboard operation
Spec copied to clipboard

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

Open koendehondt opened this issue 1 year ago • 2 comments

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.

koendehondt avatar Jun 18 '24 21:06 koendehondt

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.

Ducasse avatar Jun 19 '24 05:06 Ducasse

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.

koendehondt avatar Jun 19 '24 05:06 koendehondt