Generic function
Creates and returns a frame containing the specified object.
contain object #rest initargs #key own-thread? #all-keys => sheet frame
type-union(<sheet>, <class>, <frame>).
<object>.
duim-frames
duim-frames
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.
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));RETURNgadget-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