1. Gui -useid
The -useid attribute provides a powerful way to
replicate interface components. Here is an example.
which was generated with the following:
{style} {
# "Give widgets a bit less of that unix-y feel"
Toplevel {
*Labelframe.Pad 10
*Labelframe.foreground blue
*Canvas.borderWidth 2
*Canvas.relief raised
*Spinbox.width 8
*Text.width 30
*Text.height 9
*Text.wrap none
*Text.background #dcdcdc
*Text.borderWidth 1
*Spinbox.borderWidth 1
*Button.borderWidth 1
*Scrollbar.width 10
}
.canvas* { -bg Blue }
Button^spacer { -relief flat -state disabled }
Label^matrixes { -padx 5 }
Spinbox { -buttonbackground CornFlowerBlue }
^mat { @pack {-pady 5} }
@tip {
button "Click to reset values"
button2 "Click to reset all values"
}
}
title "OpenGL Editor"
{Frame + -pos l* -subpos *} {
{Canvas - -scroll *} {}
{Canvas - -scroll *} {}
}
{Frame + -pos l*} {
{Labelframe + -label "View (Camera)" -pos * -id viewcam} {
# "Top LHS"
{grid + -pos l -subpos e -subgid matin -minsizes 75 -pads {{} {} 10}} {
{row +} {
Label X
Spinbox {}
Button Reset
}
{row +} {
Label {Position Y}
Spinbox {}
}
{row +} {
Label Z
Spinbox {}
}
{row +} { {Label - -gid spacer} {} }
{row +} {
Label Pitch(X)
Spinbox {}
}
{row +} {
Label Heading(Y)
Spinbox {}
}
{row +} {
Label Roll(Z)
Spinbox {}
}
}
{Frame + -pos l*|} {
Label {OpenGL Functions}
{Text - -pos * -scroll *} {}
}
}
{Labelframe + -pos * -label "Model" -useid viewcam} {}
{Frame + -subpos l -subgid mat -id matrixes} {
{Labelframe + -label "Model Matrix" -id matrix} {
{grid + -subgid matrixes} {
{row +} {Label 0 Label 0 Label 0 Label 0}
{row +} {Label 0 Label 0 Label 0 Label 0}
{row +} {Label 0 Label 0 Label 0 Label 0}
{row +} {Label 0 Label 0 Label 0 Label 0}
}
}
Label =
{Labelframe + -label "Model Matrix" -useid matrix} {}
Label X
{Labelframe + -label "Model Matrix" -useid matrix} {}
}
}
© 2008 Peter MacDonald