From 452b920a9d969179e7b4408afaab3311e2b5f3f8 Mon Sep 17 00:00:00 2001 From: Koen De Hondt Date: Sun, 15 Sep 2024 16:12:12 +0200 Subject: [PATCH] Use a block to determine the enablement state of a menu item that is created based on a command, otherwise the menu item is not enabled/disabled correctly when its parent menu opens --- src/Spec2-Commander2/CmUICommandDisplayStrategy.extension.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Spec2-Commander2/CmUICommandDisplayStrategy.extension.st b/src/Spec2-Commander2/CmUICommandDisplayStrategy.extension.st index 4c0a5155..6a46b15d 100644 --- a/src/Spec2-Commander2/CmUICommandDisplayStrategy.extension.st +++ b/src/Spec2-Commander2/CmUICommandDisplayStrategy.extension.st @@ -2,9 +2,10 @@ Extension { #name : 'CmUICommandDisplayStrategy' } { #category : '*Spec2-Commander2' } CmUICommandDisplayStrategy >> display: aCmSpecCommand in: aMenuOrGroupPresenter do: aBlock [ + aMenuOrGroupPresenter addItem: [ :item | aBlock value: item. - item enabled: aCmSpecCommand canBeExecuted. + item enabled: [ aCmSpecCommand canBeExecuted ]. item ] ]