Next Previous Up Top Contents Index

9.4 DUIM-Frames Module

contain

Generic function

Summary

Creates and returns a frame containing the specified object.

Signature

contain object #rest initargs #key own-thread? #all-keys => sheet frame

Arguments

object
An instance of type type-union(<sheet>, <class>, <frame>).

initargs
Instances of type <object>.

Values

sheet
An instance of type <sheet>.

frame
An instance of type <frame>.

Library

duim-frames

Module

duim-frames

Description

Creates and returns a frame containing object. This function is intended to be used as a convenience function when testing sections of code in development; you are note recommended to use it in your final source code. The function wraps a set of DUIM objects in a frame and displays them on screen, without you needing to worry about the creation, management, or display of frames on the computer screen. The contain function is most useful when testing code interactively using the Dylan Interactor.

If own-thread? is #t, then the window that is created by contain runs in its own thread. If not supplied, own-thread? is #f.

Consider the following expression that calls contain:

contain(make(<button>));

This is equivalent to the fuller expression:

begin
   let frame = make(<simple-frame>, 
                     title: "container", 
                     layout: make(<button>));
   start-frame(frame);
end;

As can be seen, when testing short pieces of code interactively in the environment, the former section of code is easier to use than the latter.

Example

Assigning the result of a contain expression allows you to manipulate the DUIM objects being contained interactively, as shown in the example below.

You should assume the following code is typed into the Dylan Interactor, and that each expression is evaluated by pressing the RETURN key at the points indicated.

*g* := contain
         (make
           (<list-box>, 
            items: #(#"One", #"Two", #"Three"),
            label-key: 
              method (symbol) as-lowercase
                                (as(<string>, symbol))
              end));RETURN
gadget-items(*g*);RETURN

As you would expect, evaluating the call to gadget-items returns the following result:

#(#"one", #"two", #"three")

In a similar way, you can destructively modify the slot values of any contained DUIM objects


Functional Developer Library Reference: DUIM - 3 Dec 1998

Next Previous Up Top Contents Index