Frames are typically used with a corresponding structured attribute to provide a logical appearance for the user, although you can build frames simply for their structuring properties. The typical use of a frame is:
[frame attr=Items border=3 relief=groove side=top] [entry attr=Items.Qty width=10] [entry attr=Items.Code width=10] [entry attr=Items.Desc width=10] [entry attr=Items.Taxable width=10] [break] [entry attr=Items.Price width=10] [entry attr=Items.Total width=10] [end frame]
A frame command forces QddbScript to start a new frame at the current level. If the frame is attributed (that is, it has an attr= option), it is associated with a structured attribute from the Qddb Schema and will automatically contain Add, View, and Del buttons if it is also expandable.
Inside the frame, the subattributes are separated by [break]
statements. Each [break]
statement forces QddbScript to
begin a new row (an inner frame) inside the frame. For example,
if we want to see the above frame's contents in three rows instead
of two, we simply insert another break statement:
[options autoalign] [frame attr=Items border=3 relief=groove side=top] [entry attr=Items.Qty width=10] [entry attr=Items.Code width=10] [break] [frame ipadx=10 ipady=10 noexpand] ;# do some odd padding [entry attr=Items.Desc width=10] [entry attr=Items.Taxable width=10] [end frame] [break] [entry attr=Items.Price width=10] [entry attr=Items.Total width=10] [end frame]
By default, the frames and entries will expand to fill
the width of the screen. If the option autoalign is on (via an
[options autoalign]
statement) the first entry in each
frame will have a fixed-width label ($w.f_0.l) so the entries
will line up on the form. If for some reason you do not
want a frame to expand to fill the width of its parent, add
the option noexpand to the frame statement as shown above.
Each attributed frame creates a command based on the name of the
attribute and an '=' prefix. For example, the frame above creates
a Tcl command =Items
that may be used to address the special
features and options of the Fx_Frame (see Fx_Frame(n)).
The side option specifies where the frame will be physically located within its parent frame. By default, frames are packed at the top of their parent, effectively stacking them one after the other. If you need two side-by-side frames, you might do something like this:
[options autoalign] # ... [frame attr=Items border=3 relief=groove side=top] [options noautoalign] ;# turn off autoalign [frame side=left] [entry attr=Items.Qty labelwidth=12 side=top] [entry attr=Items.Code labelwidth=12 side=top] [end frame] [frame side=left] [entry attr=Items.Desc labelwidth=12 side=top] [entry attr=Items.Taxable labelwidth=12 side=top] [end frame] [options autoalign] ;# turn autoalign back on [break] [entry attr=Items.Price width=10] [entry attr=Items.Total width=10] [end frame]