Somehow I missed your response -_-
the first example is based on what is used in MenuModel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ApplicationWithToolbar>>initialize
menu :=
MenuModel new
addGroup:
[ :group |
group
addItem: [ :item |
item��
name:
'File';
icon:
Smalltalk ui icons openIcon;
subMenu:
self subMenu ].
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
it is useful as you don't need to worry about creating new
instances of MenuGroup/MenuItem constantly.
The reason for the value holder and why I didn't want to go
with creating custom classes is that it would (in my opinion)
create extra mess.
What I am trying to achieve is some sort of Form Builder...
each item in the form has a label and the form component
(which is a spec widget).
Thus I would have to wrap every single spec widget with yet
another class so I can set the label.
The second variant (b) is probably the worst (just like any
block with >1 arguments)
So maybe the last one is the best fit... this is used by
WorldMenu builder.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
menuCommandOn: aBuilder
<worldMenu> (aBuilder item: #DynaUML) icon: DCIcons
current dcOmlDiagramIcon; label: 'UML Class Diagram';
parent: #MostUsedTools; action: [ self openEmpty ];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Peter