Hi Stephan, You are 100% right: I had similar code in there during my hacking but I decided to take it out to simplify things. A couple of important semantic constants are indeed missing. But it is not just that, IMHO, the LoginModel should say 'I am 2 fields heigh', the wrapping in the Dialog should add what is needed around that, because the dialog is adding stuff that the wrapped component does not know about.
Also, given Spec's (unfulfilled) ambition to have different backends, the whole idea of careful layout and measuring becomes quite hard, because that should be totally abstract. Sven > On 13 Feb 2015, at 10:48, Stephan Eggermont <[email protected]> wrote: > > In order to not get results like > <PastedGraphic-1.png> > > the extent and width should be calculated values. > > That would change the example code to something like > > LoginModel class>>defaultSpec > <spec: #default> > ^SpecLayout composed > newColumn: [ :col | > col > newRow: [ :row | > row > add: #usernameLabel width: self labelWidth; > add: #usernameField ] > height: self inputTextHeight; > newRow: [ :row | > row > add: #passwordLabel width: self labelWidth; > add: #passwordField ] > height: self inputTextHeight ]; > yourself > > LoginModel class>>labelWidth > ^((StandardFonts defaultFont widthOfString: 'Password') max: > (StandardFonts defaultFont widthOfString: 'Username'))+12 > > Please note that there are still several places in Spec where > hardcoded values like 12 are used instead of semantic values. > This value should actually be dependent on font size. > Having the label texts twice in the code should also be avoided. > > LoginModel class>>textFieldWidth > ^(StandardFonts defaultFont widthOfString: > '[email protected]')+12 > > LoginModel>>initialExtent > ^(3*12+self class labelWidth+ self class textFieldWidth) @ (5*self > class buttonHeight) > > There are several calculated values missing: > width = outside border + labelWidth + label field > separator+fieldWidth+outside border > height = dialog title + textInput height + separator + textInput height+ > separator+button height + outside border > > Stephan
