Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alignment not applied when using SpBoxLayout>>#addLast: #1615

Open
koendehondt opened this issue Oct 4, 2024 · 0 comments
Open

Alignment not applied when using SpBoxLayout>>#addLast: #1615

koendehondt opened this issue Oct 4, 2024 · 0 comments

Comments

@koendehondt
Copy link
Contributor

As mentioned in #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:

Screenshot 2024-10-04 at 08 26 09

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:

Screenshot 2024-10-04 at 08 28 25

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:

Screenshot 2024-10-04 at 08 30 11

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:.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant