#!../src/moat

xtAppInitialize

# widgets
xmMainWindow .main managed
xmForm .main.form managed
xmList .main.form.list managed \
    -selectionPolicy single_select
xmLabel .main.form.Name managed \
    -alignment alignment_end
xmLabel .main.form.Telephone managed \
    -alignment alignment_end
xmText .main.form.name managed
xmText .main.form.telephone managed

# geometry
.main.form.list setValues \
    -topAttachment attach_form \
    -leftAttachment attach_form \
    -bottomAttachment attach_form
.main.form.Name setValues \
    -topAttachment attach_form \
    -leftAttachment attach_widget \
    -leftWidget .main.form.list \
    -rightAttachment attach_opposite_widget \
    -rightWidget .main.form.Telephone
.main.form.Telephone setValues \
    -topAttachment attach_position \
    -topPosition 50 \
    -leftAttachment attach_widget \
    -leftWidget .main.form.list
.main.form.name setValues \
    -topAttachment attach_form \
    -rightAttachment attach_form \
    -leftAttachment attach_widget \
    -leftWidget .main.form.Name
.main.form.telephone setValues \
    -topAttachment attach_position \
    -topPosition 50 \
    -rightAttachment attach_form \
    -leftAttachment attach_widget \
    -leftWidget .main.form.Telephone

# set values in List
.main.form.list setValues \
    -items {"Jan Newmarch" "John Ousterhout" "Stephen Prendergast"} \
    -itemCount 3

# add a callback
.main.form.list singleSelectionCallback {
    .main.form.name setValues \
	-value "%item"
}

# set it going

. realizeWidget
. mainLoop
