As mentioned in https://github.com/pharo-spec/Spec/issues/1614, it is unclear whether SpBoxLayout>>#addLast: should still be used and if not, what the alternative is. Given that Pharo itself still sends the message in Pharo 12 and Pharo 13, I like to report an issue.
Consider this code:
presenter := SpPresenter new.
presenter layout: (SpBoxLayout newLeftToRight
vAlignCenter;
add: (SpButtonPresenter new label: 'Button 1'; yourself);
add: (SpButtonPresenter new label: 'Button 2'; yourself);
yourself);
open
Note vAlignCenter to align the two buttons in the center.
The code opens this window:
All is good.
Now change the code:
presenter := SpPresenter new.
presenter layout: (SpBoxLayout newLeftToRight
vAlignCenter;
add: (SpButtonPresenter new label: 'Button 1'; yourself);
addLast: (SpButtonPresenter new label: 'Button 2'; yourself);
yourself);
open
The only difference is that addLast: is sent instead of add: to add the second button. The window opens like this:
That is not expected. Sending vAlignCenter appears not to have any impact anymore on the second button.
Now change the code to:
presenter := SpPresenter new.
presenter layout: (SpBoxLayout newLeftToRight
vAlignEnd;
add: (SpButtonPresenter new label: 'Button 1'; yourself);
addLast: (SpButtonPresenter new label: 'Button 2'; yourself);
yourself);
open
The only change is sending vAlignEnd instead of vAlignCenter. Now the window opens like this:
Again, we see that sending vAlignEnd has no effect on the second button.
This is a bug. The alignment should be applied to presenters that are added with SpBoxLayout>>#addLast:.
As mentioned in https://github.com/pharo-spec/Spec/issues/1614, it is unclear whether
SpBoxLayout>>#addLast:
should still be used and if not, what the alternative is. Given that Pharo itself still sends the message in Pharo 12 and Pharo 13, I like to report an issue.Consider this code:
Note
vAlignCenter
to align the two buttons in the center.The code opens this window:
All is good.
Now change the code:
The only difference is that
addLast:
is sent instead ofadd:
to add the second button. The window opens like this:That is not expected. Sending
vAlignCenter
appears not to have any impact anymore on the second button.Now change the code to:
The only change is sending
vAlignEnd
instead ofvAlignCenter
. Now the window opens like this:Again, we see that sending
vAlignEnd
has no effect on the second button.This is a bug. The alignment should be applied to presenters that are added with
SpBoxLayout>>#addLast:
.