[Pharo-project] Menu creation and invocation

Alain Plantec alain.plantec at yahoo.com
Thu Feb 17 21:51:47 CET 2011


he he he.
thanks Fernando.
and really really happy that you find it useful.

but is see maybe an issue here. It concerns the pragma keyword.
It is currently a global keyword.
Maybe one should also allow a way to specify where the pragma are to be 
collected.
maybe something like:

MyMorph>>menuBuilder
	^ (PragmaMenuBuilder localPragmaKeyword: 'tileMenu' model: self )

notice the #localPragmaKeyword:model selector instead of #pragmaKeyword:model.
it would constraint the builder to only search pragma locally.
does it make sense to you ?

Cheers
Alain




Le 17/02/2011 21:15, Fernando Olivero a écrit :
> I want to give the thanks to Alain, for the excellent work on
> PragmaMenuBuilder!
> Making menus is elegant and straightforward this way!
>
> I post here how i'm using them:
>
> MyMorph>>mouseDown: aMouseEvent
> 	aMouseEvent redButtonPressed ifTrue:[ self click: aMouseEvent ].
> 	aMouseEvent yellowButtonPressed ifTrue:[ self leftClick: aMouseEvent ].
> 	
> MyMorph>>leftClick: aMouseEvent	
> 	self menuBuilder menu popUpInWorld
>
> MyMorph>>menuBuilder
> 	^ (PragmaMenuBuilder pragmaKeyword: 'tileMenu' model: self)
>
> And you can nicely decouple the menu invocation from the menu creation!
>
> Thanks!
>
> Fernando
>
>





More information about the Pharo-project mailing list