Skip to content

Commit dff411b

Browse files
committed
doc,custom-views: refill some paragraphs, fixup some wording
1 parent 8a09d78 commit dff411b

File tree

1 file changed

+26
-27
lines changed

1 file changed

+26
-27
lines changed

gui-easy/gui/easy/scribblings/custom-views.scrbl

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
You can create your own views by implementing the @racket[view<%>]
2323
interface.
2424

25-
As an example, let's wrap Jeffrey Massung's @|canvas-list-link|. I find
26-
it helps to work backwards from the API you'd like to end up with. In
25+
As an example, let's wrap Jeffrey Massung's @|canvas-list-link|. I find
26+
it helps to work backwards from the API you'd like to end up with. In
2727
this case, that would be:
2828

2929
@racketblock[
@@ -36,8 +36,8 @@ this case, that would be:
3636
]
3737

3838
A @racketid[canvas-list] takes an observable of a list of entries, a
39-
function that knows how to draw each entry to a @racket[gui:dc<%>] and
40-
a callback for when the user double-clicks an entry. The
39+
function that knows how to draw each entry to a @racket[gui:dc<%>]
40+
and a callback for when the user double-clicks an entry. The
4141
@racketid[canvas-list] function should then look something like this:
4242

4343
@racketblock[
@@ -48,9 +48,9 @@ a callback for when the user double-clicks an entry. The
4848
[action action]))
4949
]
5050

51-
All it needs to do is abstract over the instantiation of the
52-
underlying @racket[view<%>]. Next, we can define a skeleton
53-
implementation of @racketid[canvas-list-view%]:
51+
All it needs to do is abstract over the instantiation of the underlying
52+
@racket[view<%>]. Next, we can define a skeleton implementation of
53+
@racketid[canvas-list-view%]:
5454

5555
@racketblock[
5656
(define canvas-list-view%
@@ -72,8 +72,8 @@ implementation of @racketid[canvas-list-view%]:
7272
]
7373

7474
Views must communicate what @tech{observables} they depend on to their
75-
parents. Since the only dependency a canvas list has is its set of
76-
entries, that's straightforward:
75+
parents. Since the only dependency a canvas list has is its set of
76+
entries. That's straightforward:
7777

7878
@racketblock[
7979
(define canvas-list-view%
@@ -87,9 +87,9 @@ entries, that's straightforward:
8787
]
8888

8989
When a view is rendered, its parent is in charge of calling its
90-
@method[view<%> create] method. That method must instantiate a GUI
90+
@method[view<%> create] method. That method must instantiate a GUI
9191
object, associate it with the passed-in @racketid[parent], perform any
92-
initialization steps and then return it. In our case:
92+
initialization steps and then return it. In our case:
9393

9494
@racketblock[
9595
(define canvas-list-view%
@@ -108,11 +108,11 @@ initialization steps and then return it. In our case:
108108
...))
109109
]
110110

111-
When the @tech{observables} the view depends on change, its parent
112-
will call its @method[view<%> update] method with the GUI object that
113-
the view returned from its @method[view<%> create] method, the
114-
observable that changed and the observable's value when it changed.
115-
The view is then in charge of modifying its GUI object appropriately.
111+
When the @tech{observables} the view depends on change, its parent will
112+
call its @method[view<%> update] method with the GUI object that the
113+
view returned from its @method[view<%> create] method, the observable
114+
that changed and the observable's value when it changed. The view is
115+
then in charge of modifying its GUI object appropriately.
116116

117117
@racketblock[
118118
(define canvas-list-view%
@@ -132,11 +132,10 @@ The view is then in charge of modifying its GUI object appropriately.
132132
program exits.
133133
}
134134

135-
Finally, when a view is no longer visible, its @method[view<%>
136-
destroy] method is typically called to dispose of the GUI object and
137-
perform any teardown actions. In our case, there's nothing to tear
138-
down so we can let garbage collection take care of destroying the
139-
@racketid[canvas-list%] object:
135+
Finally, when a view is no longer visible, its @method[view<%> destroy]
136+
method is called to dispose of the GUI object and perform any teardown
137+
actions. In our case, there's nothing to tear down so we can let garbage
138+
collection take care of destroying the @racketid[canvas-list%] object:
140139

141140
@racketblock[
142141
(define canvas-list-view%
@@ -147,19 +146,19 @@ down so we can let garbage collection take care of destroying the
147146
(void))))
148147
]
149148

150-
When the view becomes visible again, its @method[view<%> create]
151-
method will be called again and the whole cycle will repeat itself.
149+
When the view becomes visible again, its @method[view<%> create] method
150+
will be called again and the whole cycle will repeat itself.
152151

153-
That's all there is to it when it comes to custom controls. See the
152+
That's all there is to it when it comes to custom controls. See the
154153
@|example-link-hn| example for a program that uses a custom view.
155154

156155

157156
@section{Custom Containers}
158157

159158
Containers are slightly more complicated to implement than controls.
160159
They must collect all their children's unique dependencies and list
161-
them in their @method[view<%> dependencies] method. Additionally,
162-
their @method[view<%> update] method is in charge of dispatching
163-
updates to their children.
160+
them in their @method[view<%> dependencies] method. Additionally, their
161+
@method[view<%> update] method is in charge of dispatching updates to
162+
their children.
164163

165164
See @|example-link-panel| for an example.

0 commit comments

Comments
 (0)