On Thu, Apr 19, 2012 at 3:19 PM, Stéphane Ducasse <[email protected] > wrote:
> I'm quite sure that we should be able to get a faster and cleaner way to > define on/off buttons…. > > (state = true or: [state isString and: [(state beginsWith: '<yes>') > or: [state beginsWith: '<on>']]]) > > http://code.google.com/p/pharo/issues/detail?id=5633 > > :( > > > icon > "Answer the receiver's icon. Handle legacy case > of wording-based mechanism." > > |state| > self getStateSelector ifNil: [^super icon]. > state := (MessageSend receiver: self target selector: self > getStateSelector) > valueWithEnoughArguments: self arguments . > (state = true or: [state isString and: [(state beginsWith: '<yes>') > or: [state beginsWith: '<on>']]]) > ifTrue: [^self onIcon]. > (state = false or: [state isString and: [(state beginsWith: '<no>') > or: [state beginsWith: '<off>']]]) > ifTrue: [^self offIcon]. > ^super icon > > > benjamin suggested that we had support for the string 'true' and 'false' > in case :) > 0 for false and non-0 for true is a good option to add also :P > > Stef >
