
CHAPTER 4: User-Interface Tools Automatic layout 93
info: Panel { orientation: ’column’, \
text: ’Personal Info’, \
name: Group { orientation: ’row’, \
s: StaticText { text:’Name:’ }, \
e: EditText { characters: 30 } \
}, \
addr: Group { orientation: ’row’, \
s: StaticText { text:’Street / City:’ }, \
e: EditText { characters: 30 } \
}\
}, \
buttons: Group { orientation: ’row’, \
okBtn: Button { text:’OK’, properties:{name:’ok’} }, \
cancelBtn: Button { text:’Cancel’, properties:{name:’cancel’} } \
} \
}";
win = new Window (res);
win.center();
win.show();
In this simplest example, the columns are not vertically aligned. When you are using fixed-width controls
in your rows, a simple way to get an attractive alignment of the
StaticText labels for your EditText
fields is to align the child rows in the
Panel to the right of the panel. In the example, add the following to
the
Panel specification:
info: Panel { orientation: ’column’, alignChildren:’right’, \
This creates the following result:
Suppose now that you need two panels, and want each panel to have the same width in the dialog. You
can specify this at the level of the dialog window object, the parent of both panels. Specify
alignChildren='fill', which makes each child of the dialog match its width to the widest child.
res =
"dialog { alignChildren: ’fill’, \
info: Panel { orientation: ’column’, alignChildren:’right’, \
text: ’Personal Info’, \
name: Group { orientation: ’row’, \
s: StaticText { text:’Name:’ }, \
e: EditText { characters: 30 } \
Kommentare zu diesen Handbüchern