Comment to chapter 9
p. 89 SpPresenter << #WindowExamplePresenter slots: {#button1 . #button2}; package: 'SpecBook' – the name of the package differs from the corresponding one in the GitHub repository: CodeOfSpec20Book2-Windowing.
p. 90 Mistakes in the code snippet
| we |
we := WindowExamplePresenter new.
we open.
we openWithLayout: aLayout.
we openWithLayout: aLayout
There are two identical messages with unknown argument aLayout. Examples from the repository advise use to use #defaultSpec and we defaultSpec instead – but that does not work in Pharo 11.
p. 91
- “The message cancelled sent to diag will return true if the dialog was closed by clicking on the Cancel button.” This is not true. “WindowExamplePresenter new openDialog cancelled” always return true while the window remines opened. We have to use openModal instead openDialog to get an appropriate result of cancelled sending.
- Usually we can close a dialog window by pressing [Esc] key. Question: is it normal, that sending cancelAction: aBlock cancels this behavior and the dialog stops responding to [Esc]? Should we explain this situation in the book?
p. 92 The last code snippet: “we := WindowExamplePresenter3 new.” – digit 3 should be removed.
p. 93 The code snippet does not work (as mentioned in the book)
| we |
we := WindowExamplePresenter new.
we extent: 300@80.
we open.
But the next one works | we | we := WindowExamplePresenter new. we open. we withWindowDo: [ :aWindow | aWindow extent: 300@80].
p. 94 All code snippets are wrong. “wewin window beUnresizeable; removeCollapseBox; removeExpandBox; removeCloseBox; removeMenuBox” does not work: SpWindowPresenter does not understand …
p. 95 The subchapter 9.13 Setting the icon contains a raceme of bugs.
- ComposableModel – unknown class
- Note that it does not matter if the message is sent before or after the window is opened. – this is not true. SpPresenter does not understand “windowIcon:”, so “wm1 windowIcon:…” is a bug, it should be “wm1 window windowIcon:…”, therefore it should be after "wm1 open".
- Executing the method windowIcon: newIcon does not affect either the appearance of the window nor the taskbar.
- WindowExample – unknown class
- Defining the method windowIcon does not affect either the appearance of the window nor the taskbar.
p. 96 Bug in the code snippet: “we aboutText: 'Click + to grow, - to shrink.'.” should be ”we window aboutText: 'Click + to grow, - to shrink.'.”