If I want to do...
=== formDescriptionNewUserRegistration | loginDesc | loginDesc := self description copy. (loginDesc atLabel: 'Username') beWriteable; beRequired; addCondition: [ :newUserName | self client login isLoginUsernameAvailable: newUserName ] labelled: 'already taken'. ^ loginDesc ===== The copy is needed, because I dont want to modify the cached version, that everyone else is using. However, I dont think that the children are copied, they remain the same objects. Could/should they be copied in MAContainer-#postCopy ? Keith _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
If I want to do...
> > === > formDescriptionNewUserRegistration > > | loginDesc | > > loginDesc := self description copy. > > (loginDesc atLabel: 'Username') > beWriteable; > beRequired; > addCondition: [ :newUserName | > self client login isLoginUsernameAvailable: newUserName ] > labelled: 'already taken'. > > ^ loginDesc > > ===== > > The copy is needed, because I dont want to modify the cached version, > that everyone else is using. However, I dont think that the children are > copied, they remain the same objects. > > Could/should they be copied in MAContainer-#postCopy ? > > Keith > expensive for this use case. I have adopted the following idiom. #formDescriptionForgottonPassword ^ self description atLabel: 'E-mail' modify: [ :d | d componentClass: MATextInputComponent ]; atLabel: 'Username' modify: [ :d | d beWriteable ]; atLabel: 'Password' modify: [ :d | d beHidden ]; yourself Keith _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
In reply to this post by keith1y
If I want to do...
> > === > formDescriptionNewUserRegistration > > | loginDesc | > > loginDesc := self description copy. > > (loginDesc atLabel: 'Username') > beWriteable; > beRequired; > addCondition: [ :newUserName | > self client login isLoginUsernameAvailable: newUserName ] > labelled: 'already taken'. > > ^ loginDesc > > ===== > > The copy is needed, because I dont want to modify the cached version, > that everyone else is using. However, I dont think that the children are > copied, they remain the same objects. > > Could/should they be copied in MAContainer-#postCopy ? > > Keith > expensive for this use case. I have adopted the following idiom. #formDescriptionForgottonPassword ^ self description copy atLabel: 'E-mail' modify: [ :d | d componentClass: MATextInputComponent ]; atLabel: 'Username' modify: [ :d | d beWriteable ]; atLabel: 'Password' modify: [ :d | d beHidden ]; yourself Keith _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Free forum by Nabble | Edit this page |