[Cuis-dev] registerAll/unregisterAll menus

Juan Vuletich juan at jvuletich.org
Mon May 5 08:53:25 PDT 2025


Hi Hernán,

All your contributions from 4/29 are now on GitHub.

Thanks!

On 4/29/2025 8:56 AM, Hernán Wilkinson via Cuis-dev wrote:
> Hi,
>  packages that add menus can have a lot of repeated code to add them 
> and remove them.
>  The attached .cs adds two messages to SystemWindow to avoid that 
> duplicated code: registerAll: and unregisterAll:
>  With this messages, code that look like this:
>
> initialize
> BrowserWindow
>    at: #systemCatListMenuSpec
>    registerMenuAndShortcutsSpecProvider: (MessageSend receiver: self 
> selector: #systemCatListMenuSpec).
> BrowserWindow
>    at: #classListMenuSpec
>    registerMenuAndShortcutsSpecProvider: (MessageSend receiver: self 
> selector: #classListMenuSpec).
> ... and so on
>
> unload
> BrowserWindow
>    at: #systemCatListMenuSpec
>    unregisterMenuAndShortcutsSpecProvider: (MessageSend receiver: self 
> selector: #systemCatListMenuSpec).
> BrowserWindow
>    at: #classListMenuSpec
>    unregisterMenuAndShortcutsSpecProvider: (MessageSend receiver: self 
> selector: #classListMenuSpec).
> ... and so on
>
> Now it looks like this:
> initialize
>    BrowserWindow registerAll: self browserWindowMenuSpecs.
> unload
>    BrowserWindow unregisterAll: self browserWindowMenuSpecs.
> browserWindowMenuSpecs
>    ^{ { #systemCatListMenuSpec. self systemCatListMenuSpecSend }.
>        { #classListMenuSpec. self classListMenuSpecSend }}
>
> Cheers!
> Hernan.
>
> -- 
> *Hernán Wilkinson
> Agile Software Development, Teaching & Coaching*
> *Phone: +54-011*-4893-2057
> *Twitter: @HernanWilkinson*
> *site: http://www.10Pines.com <http://www.10pines.com/>*
> Address: Alem 896, Floor 6, Buenos Aires, Argentina


-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
https://independent.academia.edu/JuanVuletich
https://www.researchgate.net/profile/Juan-Vuletich
https://patents.justia.com/inventor/juan-manuel-vuletich
https://twitter.com/JuanVuletich


-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
https://independent.academia.edu/JuanVuletich
https://www.researchgate.net/profile/Juan-Vuletich
https://patents.justia.com/inventor/juan-manuel-vuletich
https://twitter.com/JuanVuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250505/4cf998f2/attachment-0001.htm>


More information about the Cuis-dev mailing list