<\body> are collections of widgets arranged in a window in order to perform a common task. You might want to create one of this in order to configure or interact with a plugin: add some configuration options as well as some common actions and have the window always open besides your document. A good example whose code might help is the preferences dialog . In order to create more complex layouts than those we did before you'll need a few containers. Among these are and , which we explain below. A very useful macro which you'll be using often is : it allows you to embed one widget into another. Let's see how you create a dialog. To get started here is one little example taken from : <\session|scheme|default> <\unfolded-io|Scheme] > (tm-widget (widget1) \ \ (centered \ \ \ \ (aligned \ \ \ \ \ \ (item (text "First:") \ \ \ \ \ \ \ \ (toggle (display* "First " answer "\\n") #f)) \ \ \ \ \ \ (item (text "Second:") \ \ \ \ \ \ \ \ (toggle (display* "Second " answer "\\n") #f))))) <|unfolded-io> \; The keyword is clear, just center whatever it contains, but not so much: it builds two column tables, with each row of type . As you can see, each takes two arguments, which can be of type. The is another example of a widget which triggers a command whenever it's clicked, or toggled in this case. The second argument stands for the default state of the . Again, in order to display this you create a and give it a title. <\session|scheme|default> <\input|Scheme] > (top-window widget1 "Two toggle widgets") You'll notice that the created window is too small and the title is not wholly displayed. You can force it to be of a certain size using : <\session|scheme|default> <\unfolded-io|Scheme] > (tm-widget (widget1) \ \ (centered \ \ \ \ (resize "500px" "200px" \ \ \ \ \ \ (aligned \ \ \ \ \ \ \ \ (item (text "First:") \ \ \ \ \ \ \ \ \ \ (toggle (display* "First " answer "\\n") #f)) \ \ \ \ \ \ \ \ (item (text "Second:") \ \ \ \ \ \ \ \ \ \ (toggle (display* "Second " answer "\\n") #f)))))) <|unfolded-io> \; <\input|Scheme] > (top-window widget1 "A bigger window") is another of the several available container or . It accepts two sorts of arguments. Either one sets a fixed size for the widget with two strings, as in the example above, or one passes two lists, the first for widths, the second for heights, with the minimum, default and maximum values in that order, like this:\ This sets to have a default square size of 200x200 pixels. If you want to add the usual buttons you use like in the following example. Notice that the widget now accepts one parameter which will be called when the user clicks the ``Ok'' button. <\session|scheme|default> <\unfolded-io|Scheme] > (tm-widget (widget1-buttons cmd) \ \ (centered \ \ \ \ (aligned \ \ \ \ \ \ (item (text "First:") \ \ \ \ \ \ \ \ (toggle (display* "First " answer "\\n") #f)) \ \ \ \ \ \ (item (text "Second:") \ \ \ \ \ \ \ \ (toggle (display* "Second " answer "\\n") #f)))) \ \ (bottom-buttons \\ ("Ok" (cmd "Ok")))) <|unfolded-io> \; Since the widget now needs an argument, we must use another function to display it, namely , which will also close the window after the button has been clicked. <\session|scheme|default> <\input|Scheme] > (dialogue-window widget1-buttons (lambda (arg) (display* arg "\\n")) "Two toggles") That special \> at the end of the widget inserts as before whitespace, but it stretches and aligns the to the right. This is just another example of a . Note that our second dialog, is just a copy of with an extra line at the end. We could have spared us the keystrokes in this way: <\session|scheme|default> <\unfolded-io|Scheme] > (tm-widget (widget1-buttons-smarter cmd) \ \ (dynamic (widget1)) \ \ (bottom-buttons \\ ("Ok" (cmd "Ok")))) <|unfolded-io> \; <\input|Scheme] > (dialogue-window widget1-buttons-smarter (lambda (arg) (display* arg "\\n")) "Two toggles") \; As you can see, the approach we've shown has a shortcoming: there's no way to access all the values of the different widgets in your dialog at the same time. Of course you can use the function passed to your widget to perform some computations, but in case you need to retrieve or store complicated data, what you need is a form. team.> >