[Pharo-dev] enabled: and menuRegistration problem

Benjamin Benjamin.VanRyseghem.Pharo at gmail.com
Wed Dec 11 05:07:29 EST 2013


Could you provide a way to reproduce it ?

Because debugging from within Mail is quite tedious :P

Ben

On 11 Dec 2013, at 10:20, Stéphane Ducasse <stephane.ducasse at inria.fr> wrote:

> Hi 
> 
> I got a bug with menu (I'm trying to reproduce it but this is a real bug) 
> 
> because in 
> 
> interpretRegistration: aRegistration 
> 	item enabled
> 			ifNil: [ node enabled: boolean not ]
> 			ifNotNil: [:boolean | node enabled: boolean ].	
> 
> 
> I will not comment on the fact that enabled should return a boolean 
> but the problem is that node does not understand enabled: 
> 
> 
> item enabled
> 	ifNil: [ node enabledBlock: item  enabledBlock ]
> 	node is a MenuRegistration and items is PragmaMenuAndShortcutRegistrationItem
> 	ifNotNil: [:boolean | node enabled: boolean ].	
> 
> And not of course does not understand enabledBlock:
> 
> 
> 
> interpretRegistration: aRegistration 
> 	| root |
> 	root := MenuRegistration owner: self.
> 	aRegistration items do: [:item || node |
> 			node := item group
> 					ifNil: [ root item: item item ]
> 					ifNotNil: [:grp | root group: grp ].
> 			item with
> 				ifNotNil: [:block || old |
> 					old := aRegistration currentRoot.
> 					aRegistration currentRoot: node name.
> 					[ node with: block ] ensure: [ aRegistration currentRoot: old ]]
> 				ifNil: [
> 					item action
> 						ifNil: [ 
> 							node 
> 								target: item target;
> 								arguments: item arguments;
> 								selector: item selector ]
> 						ifNotNil:[ 
> 							node 
> 								action: item action ]].
> 			node
> 				keyText: item keyText;
> 				help: item help;
> 				icon: item icon;
> 				order: item order;
> 				parent: item parent.
> 			item enabled
> 				ifNil: [ node ]
> 				ifNotNil: [:boolean | node enabled: boolean ].	
> 			item label
> 				ifNotNil: [ node label: item label ].
> 			item default ifNotNil: [ :d |
> 				node label: node label, ' (', d asString, ')'].
> 			item isWithSeparatorAfter
> 				ifTrue: [ node withSeparatorAfter ]]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20131211/0237b277/attachment-0002.html>


More information about the Pharo-dev mailing list