Changing window extent seems broken in P12 and P13
To reproduce:
presenter := SpPresenter new.
presenter layout: (SpBoxLayout newVertical).
presenter open.
presenter window extent. "This returns nil".
presenter window window extent. "This returns [email protected]"
presenter withWindowDo: [ :window | window extent: 100 @ 100 ]. "This does nothing"
presenter withWindowDo: [ :window | window window extent: 100 @ 100 ]. "This works"
@estebanlm can you have a look because this can impact the book? @koendehondt
I will, give me a couple of days, I am still in "back from holidays" mode :) there are some misconceptions there and at least one issue may be a bug... but I need to look at it :)
So, some answers.
- You should never use
window window, this is the backend window and you should not be going against demeters law or you will lose portability and you may cause sync problems between spec and the backend (nnot saying this will be the case here, but it could happen). -
extentandextent:are in theTOREMOVEprotocol onSpPresenter, so... you should not use it ;) - The correct protocols are:
-
initialExtent:to declare the original size of the window before it is opened. -
resize:to change the size after it is opened.
What I do believe is a bug (or a missing feature) is that there is no vocabulary to query current window size, I will add it :)
done (not integrated into P13 yet).
Ah, thanks. We tried window window while debugging; of course we don't keep that.
The use of #extent:is legacy, thank you for pointing #resize:, I will make the change in Moose.
@Ducasse
@estebanlm can you have a look because this can impact the book? @koendehondt
In the book, in chapter "9 Managing windows", there is a section "9.5 Window size and decoration" with a subsection "Setting initial size and changing size" that describes what @estebanlm wrote about the correct protocols.