-
Notifications
You must be signed in to change notification settings - Fork 65
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
Question on SpBoxLayout>>#addLast: #1614
Comments
Also see #1615 |
@estebanlm what is the replacement for this message? Because we must update the book because we use it. |
Hi, you have several (and keeping You can do: SpBoxLayout newLeftToRight
add: aPresenter; "this presenter will be expanded"
add: otherPresenter expand: false; "this one will not, making it 'last'"
yourself or you can do: SpBoxLayout newLeftToRight
hAlignEnd;
add: otherPresenter; "this presenter will be placed at the 'end' of the box."
yourself |
@koendehondt was asking Can we close this issue now? |
@estebanlm In case other people read this ticket, I like to add a comment. The examples that you gave are not inline replacements for the things you can do with This code applies a box layout that puts a button on the left and on the right: SpPresenter new
layout: (SpBoxLayout newLeftToRight
add: (SpButtonPresenter new label: 'Button 1'; yourself) expand: false;
addLast: (SpButtonPresenter new label: 'Button 2'; yourself) expand: false;
yourself);
open This cannot be achieved with the examples you gave. Nesting presenters is required, like this: left := SpPresenter new.
left layout: (SpBoxLayout newLeftToRight
add: (SpButtonPresenter new label: 'Button 1'; yourself) expand: false;
yourself).
right := SpPresenter new.
right layout: (SpBoxLayout newLeftToRight
hAlignEnd;
add: (SpButtonPresenter new label: 'Button 2'; yourself) expand: false;
yourself).
SpPresenter new
layout: (SpBoxLayout newLeftToRight
add: left;
add: right;
yourself);
open It opens a window in the same way as the previous code: I will adapt the text of the book accordingly. In particuar, this piece of text in Chapter "Layouts" has to be replaced, and the accompanying code in the code repo has to be adapted:
|
As to your question "Can we close this issue now?", I would say yes, although it would be better to add a ticket for deprecating the |
the behavior you ask for is still covered by the other, more flexible functionality, this script will cover what you want in a more elegant way than your example (yes, by nesting boxes, and aligning them correctly) : (p := SpPresenter new)
layout: (SpBoxLayout newLeftToRight
add: (p newButton label: 'Button 1'; yourself) expand: false;
add: (SpBoxLayout newLeftToRight
hAlignEnd;
add: (p newButton label: 'Button 2'; yourself);
yourself) ;
yourself);
open. |
added an issue: #1616 |
Thank you for the answers and the new ticket. |
In Pharo 12 and Pharo 13, the implementation of
SpBoxLayout>>#addLast:
is:Why is
self flag: #doNotUse.
here? It would be good to have an explanation in the method. What is the alternative?There are many senders of the message, so why are they still present if this method should not be used anymore?
Also note that the name of the method argument (
aName
) does not correspond with the name used in the method comment (aPresenterLayoutOrSymbol
).The text was updated successfully, but these errors were encountered: