Sean P. DeNigris a écrit :
There is a conversation on squeak-dev right now about how to handle world
menus / prefs / docking bar.
The participants seem to be leaning toward using pragmas, and I am a strong
voice for compatibility where we can, especially on the fundamentals.
If anyone can/wants to share their experience with the pragma solution so
far (there is a question in particular about whether it allows dynamic menu
additions/removals), it would be relevant.
Hi Sean,
you can declare a menu item with a precondition block.
the menu item is not added to the menu if the precondition is false.
We have one example in the core. See the precondition in the #'Software
update' item.
WorldState class>>systemOn: aBuilder
<worldMenu>
(aBuilder item: #System)
order: 4.0;
withSeparatorAfter;
icon: MenuIcons smallConfigurationIcon;
with: [
(aBuilder item: #'About...')
order: 0;
action: [Smalltalk aboutThisSystem].
(aBuilder item: #'Software update')
order: 1;
precondition: [self showUpdateOptionInWorldMenu];
action: [Utilities updateFromServer];
help: 'Load latest code updates via the internet']
Cheers
Alain
http://forum.world.st/Squeak-dev-World-Menu-Registry-td2064576.html
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project