Go to the first, previous, next, last section, table of contents.
MUIbase has two different operating modes, the record-editing mode, where you enter and browse
records, and the structure-editing mode where you define the structure, that is,
the tables, attributes and appearance of a project.
This chapter describes the structure editor and explains how to manage
the structure of a project.
To switch from record-editing to structure-editing mode select menu item
`Structure editor' in the `Project' menu. This will close all
windows and open the structure editor window.
To switch back to record-editing mode select menu item `Project - Exit structure editor'
or simply close the structure editor by clicking on the close button in the window title bar.
The structure editor window is divided into three parts:
in the upper left part there is a field `Tables' for managing the
tables of the project, the lower left part is occupied by a field
`Attributes' for managing the attributes of a table, and
the right part is used by a field `Display' for managing
the project's gui elements.
In the `Tables' field of the structure editor
you can create, change, delete and sort tables.
To create a new table press the `New' button in the `Tables' field.
This will open the `New table' requester containing
- a string field for entering the name of the table.
Each table must have a unique name that starts with an uppercase letter
followed by further letters, digits or underscore characters.
Non-ASCII characters like German umlauts are not allowed.
Please note that in the user interface for the table it is still possible
to display any strings including strings with non-ASCII characters.
- a field `Number of records' where you specify how many records
the table is going to hold. `Unlimited' means that the table
can hold any number of records, `Exactly one' means that the table
can have only one record. The latter one is sometimes useful for
controlling the project (see section Tables).
- a field `Trigger functions' where you can enter the names of two functions.
In the `New' string field you enter the name of the function that should
be called whenever the user wants to create a new record, the `Delete'
string field holds the name of the function that should be called whenever the
user wants to delete a record. You can use the pop-up buttons to the right
of the string fields for choosing a function name from a list of all names.
If you leave a field empty then default actions are executed (records are created
automatically and records are deleted after an optional safety requester).
For more information on how to use the trigger functions, including the
arguments that are passed to them, see section Programming MUIbase.
- two buttons `Ok' and `Cancel' for leaving the requester.
When you are done with all settings, press the `Ok' button to
create the new table. If you made an error somewhere, e.g. you entered
an invalid name, a message window pops up giving you more information about the
error you did. If everything goes fine, the `New table' requester
will be closed and the new table is displayed in the structure editor's
table list.
After you have created a new table you can still change it.
Just double-click on the table's name and the `Change table'
requester pops up. This requester is similar to the one
when creating a table (see section Creating tables) and allows
you to make changes in any field by entering a new value.
When you are done with all changes, press the `Ok' button to leave the requester.
Please note that you can't change the number of records from
`Unlimited' to `Exactly one' if the table already contains
more than one record.
To delete a table, click on the table's name in the structure editor's
table list, then press the `Del' button below the list.
Before the table is actually deleted a safety requester pops up
asking for confirmation. If you confirm this requester by pressing the
`Delete' button, the table is deleted.
A problem occurs if the table is used somewhere in the project's program.
In this case the table can't simply be deleted but all references to the table
must be removed from the program. If the table you want to delete
is used in the project's program then the program editor pops up
and displays the first occurrence to the table. You should now
modify the program such that no references to this table remain in the program.
After you removed a reference you can jump to the next one by
pressing the `Compile' button.
At any point you can still cancel the whole operation by pressing the
`Undo' button and closing the program editor.
For sorting the tables in the `Tables' field of the
structure editor you have two choices.
You can either order them by hand, that is, you use drag & drop
to rearrange a table, or you use the `Sort' button below
the list-view which orders the tables alphabetically.
In the `Attributes' field of the structure editor
you can create, change, delete and sort the attributes of the
active table in the `Tables' field.
To create a new attribute for the active table press the `New' button
in the `Attribute' field.
This will open the `New attribute' requester containing
- a string field for entering the name of the attribute.
Each attribute in a table must have an unique name that starts with an uppercase letter
followed by further letters, digits or underscore characters.
Non-ASCII characters like German umlauts are not allowed.
Please note that in the user interface it is still possible
to display any strings including strings with non-ASCII characters
for the attribute.
- a choice field `Type' where you specify the type of the attribute.
For more information on attribute types, see section Attribute types.
- a section below the `Type' field for specifying type specific
settings. For more information about this section, see section Type specific settings.
- a field `Trigger' where you can enter the name of a function
that should be called whenever the user wants to change the contents
of the attribute field in a record.
You can use the pop-up button to the right of the string field for
choosing a name from a list of all function names.
If you leave the field empty then a default action is executed, that is,
the entered value is simply stored in the attribute field.
For more information on how to use the trigger function, including the
arguments that are passed to it, see section Programming MUIbase.
- two buttons `Ok' and `Cancel' for leaving the requester.
When you are done with all settings, press the `Ok' button to
create the new attribute. If you made an error somewhere, e.g. you entered
an invalid name, a message window pops up giving you more information about the
error you did. If everything goes fine, the `New attribute' requester
will be closed and the new attribute is displayed in the structure editor's
attribute list.
In the type specific section the following settings can be specified:
- For attributes of type string you have
- an integer field `Max length' for entering the maximum string length
for this attribute field.
- a string field `Initial value' for specifying the value that is used for
initializing the attribute field.
Any string up to the specified maximum length can be entered here.
- For attributes of type integer, real, date, and time the type specific section offers
- a field `Initial value' where you specify the value for initializing
the attribute field. You can choose between `NIL' and `other'.
If you select `other' then you should enter the initial value into the
string field to the right of `other'.
- a string field `NIL string' where you enter the string that should be
displayed when the attribute field holds the NIL value.
- For bool attributes the type specific section contains a field
`Initial value' where you can choose between `NIL' and
`TRUE' for the initial value.
- The type specific section for choice attributes offers
- a button `Edit labels' for opening the
`Edit labels' window where you can enter
the label strings for the choice field (see section Label editor).
- a choice field `Initial value' for specifying
the value for initializing the attribute field.
- For reference attributes the type specific section contains
- a list-view displaying all tables for specifying to which table
the reference should be made. Click on the table the attribute is going
to reference.
- a field `Filter'. If checked the reference filter
of this attribute is turned on. See section Reference filter,
for more information about this feature.
Reference attributes always have the NIL value as initial value.
- The type specific section for virtual attributes contains
a string field `Compute' where you enter the name
of a function that should be called for calculating
the value of the attribute. You can use the attached pop-up
button for selecting a name from a list of all function names.
- Memo and button attributes do not have any type specific settings.
The initial value for memo attributes is an empty string.
Whenever you have to define a list of labels, e.g. the list of labels
for a choice attribute, the label editor comes into place.
The label editor is a window containing:
- a list-view displaying the current list of labels. You can click
on a label to make it the active one. The active label is also displayed in
the string field below the list-view. You can use drag & drop to rearrange
the labels.
- a string field `Label' that displays the active label and allows
changing it. The changes do only have effect after you pressed the Return key.
If there is currently no active label then pressing Return inserts
new labels into the list.
- a button `New' that deactivates the current label which allows
entering new labels into the `Label' string field.
- a button `Remove' that removes the active label from the list.
- a button `Sort' for ordering the list of labels alphabetically.
- two buttons `Ok' and `Cancel' for leaving the label editor.
After you entered all labels or made changes to them, press the
`Ok' button to leave the window.
After you have created a new attribute it is still possible to change
some settings of it.
Just double-click on the attribute's name and the `Change attribute'
requester pops up. This requester is similar to the one
when creating an attribute (see section Creating attributes) and allows
you to make changes in some fields. The fields that cannot be changed,
e.g. the attribute type, are displayed ghosted.
The following notes should be taken into account when changing the an attribute.
- The type of an attribute cannot be changed.
If you ever want to change the type of an attribute, it is best to create a
new one of the desired type and copy the record contents from
the old attribute to the new one by entering a simple MUIbase program
in the query editor (see section Query editor).
- If you change the initial value of an attribute then
only new records will get the new value for initializing the record.
- For choice attributes you should be careful when changing its labels.
The labels are only used for displaying the choice field contents,
internally, numbers are stored that are used as an index into the
list of labels. Thus, if you change the order of labels, you actually
don't change the internal number but the label which is displayed for it!
Therefore you should not change the order of labels after you created
a choice attribute. Appending new labels to the end of the label list,
however, doesn't make any problems.
For a more flexible way of having a choice-like field where you can also
change the order of labels, use a string attribute together with the
`List-view pop-up' feature (see section Attribute object editor).
- The referenced table of a reference attribute cannot be changed.
When you are done with all changes, press the `Ok' button to leave the requester.
To delete an attribute, click on it's name in the structure editor's
attribute list and press the `Del' button below the list.
Before the attribute is actually deleted a safety requester pops up
asking for confirmation. If you confirm this requester by pressing the
`Delete' button, the attribute is deleted.
A problem occurs if the attribute is used somewhere in the project's program.
In this case the attribute can't simply be deleted but all references to it
must be removed from the program. If the attribute you want to delete
is used in the project's program then the program editor pops up
and displays the first occurrence to this attribute. You should now
modify the program such that no references to this attribute remain in the program.
After you removed a reference you can jump to the next one by
pressing the `Compile' button.
At any point you can still cancel the whole operation by pressing the
`Undo' button and closing the program editor.
For sorting the attributes in the `Attributes' field of the
structure editor you have two choices.
You can either order them by hand, that is, you use drag & drop
to rearrange an attribute, or you use the `Sort' button below
the list-view which orders the attributes alphabetically.
In the `Display' field of the structure editor you specify
how the database elements should be arranged in the user interface.
The field consists of a choice field, a list-view and several buttons.
The display field contains the following items:
- a choice item with two settings, `Table mask'
and `Root window'. In `Table mask' you specify
how the attributes of the active table are arranged in the user interface.
In `Root window' you specify how the tables are arranged.
- a list-view that displays the current specification
of the user interface. The list is organized as a tree.
Items that have an arrow to its left are composite
gui objects and can be opened and closed by double-clicking on the arrow symbol.
A double-click on the item itself opens a window for editing its settings.
All gui objects that have the same parent object are layed out
in the same way (either vertically or horizontally).
How the layout is done is determined by the parent gui object:
tables, panels and windows layout their elements vertically,
groups layout their elements according to the settings
in the group editor (see section Group editor).
- a button `Panel' for adding a panel to the table.
See section Panel editor, for more information about setting up a panel.
- a button `Add' for adding the active table or the active attribute
(depending on the state of the display choice field) to the display list-view.
Usually tables and attributes are added to the display list-view automatically
when you create them.
- a button `Rem' for removing the active item from the display list-view.
If you remove a table then the whole table form is removed from the user interface,
thus you can't see the table in the project's gui.
If you remove an attribute from the display list-view then the attribute
doesn't appear in the project's gui. This is useful for hiding attributes.
- two buttons `Up' and `Down' for moving the active item one field up,
respectively down, in the display list-view.
- two buttons `In' and `Out'
for moving the active item one hierarchical level down or up in the display list-view.
- a button `Text' for adding a text object to the display list-view.
See section Text editor, for more information about setting up a text object.
- a button `Image' for adding an image object (see section Image editor).
- a button `Space' for putting space between the other objects
(see section Space editor).
- a button `Balance' for adding a balance object to the display list-view.
The balance object is useful for controlling the size of the other gui objects.
- a button `Group' for adding a group object to the display list-view.
Before you press the `Group' button you can multi-select the items in
the list-view that should be moved into the new group.
See section Group editor, for more information about setting up a group object.
- a button `Window' for adding a new window to the display list-view.
As for group objects, you can multi-select the gui objects that should
be moved into the new window. For more information about setting up
a window, see section Window editor.
For more information about the gui elements, including their usage,
see section User interface.
When you add a panel to a table's mask, or when you double click
an existing panel object in the display list-view,
the `Panel' window pops up. This window contains the
following items:
- a string field `Title' for entering a title that should be displayed
in the panel header.
- a string field `Font' with a pop-up button
for selecting a font for the title. If you leave the field empty,
a default font is used.
- a field `Background' with a check-mark field `Default'
for specifying the background of the panel header. If you check the
`Default' field then a default background is chosen.
Otherwise you can click on the `Background' button to open a
window for specifying the background setting (see the MUI docs
for a description of this window).
- a field `Num/All'. If checked the number of the current
record and the number of all records are displayed in the right part
of the panel header.
- a field `Filter' that, if checked, adds a filter button
to the panel header. With the filter button you can turn on and off
the record filter of the table. If you don't check this field then
the menu item `Table - Change filter' will also be disabled for this table,
thus you can't enter a filter expression for the table.
For more information about record filters, see section Record filter.
- a field `Arrows' for adding two arrow buttons to the
table mask. The arrow buttons allows you to browse through the records
of the table. If you don't check this field then you can't browse
the records of this table and all sub menu items of menu item
`Goto record' and the menu items `Search for', `Search forward',
and `Search backward' in menu `Table' are disabled.
- two buttons `Ok' and `Cancel' for leaving the window.
After you are done with all settings, click on the `Ok'
button to close the window.
When you add an attribute to the display list-view,
a default gui object is created for it.
To change the settings of the attribute object, double click on it and
the `Display attribute' window is opened. This window contains
several items depending on the type of the attribute.
The following items are included for most attribute types:
- a string field `Title' for entering a title that is displayed
near the attribute object (or, for buttons, in the object itself).
If you leave this field empty then no title is displayed.
- a choice field `Title position' for specifying
where the title (if any) is placed relative to the attribute object.
You can choose between `Left', `Right', `Top',
and `Bottom'.
- a string field `Shortcut' for entering a letter than can be used
together with the Amiga key to activate the object.
- a field `Home'. If checked, this attribute object becomes the
home object.
The home object is used as the object where the cursor is set on
whenever a new record is allocated. This is quite useful if you
always want to start entering data into the same attribute whenever
you create a new record.
If you mark an attribute object as the home object then all other
attribute objects in the same table are unmarked.
- a field `Read only' that, if checked, gives the object a
read only status. This means that you can only read its contents but can't edit them.
If you check this field then the settings of the fields `Shortcut'
and `Home' are ignored.
- a choice field `Format' for specifying how the attribute contents
should be presented in the object. You can choose between
`Center', `Left' and `Right' for displaying the
contents centered, flushed left, or flushed right.
- a numerical field `Weight' for specifying the weight of the object.
The value of this field determines how much space, relatively to the
other objects, the object gets in the final window layout.
Usually the value of this field only affects the horizontal size
of the object as the vertical one is fixed for most attribute types.
- a field `Font' for selecting the font used for
displaying the attribute contents. If you leave the field empty,
a default font is used.
- a field `Background' with a check-mark field `Default'
for specifying how the background of the attribute should look like.
If you check the `Default' field then a default background is used,
otherwise you can click on the `Background' field to open a window
for specifying the background settings (see the MUI docs for a description
of this window).
- an editor field `Bubble help' where you can enter text that
should be displayed as the bubble help information for this attribute object.
- two buttons `Ok' and `Cancel' for leaving the window.
If you are done with all settings, press the `Ok' button to leave the window.
Besides the above items, the following type-specific items are present:
- for attributes of type string there is an `Extras' page which
contains:
- a field `Display picture' that, if checked, attaches an image field
to the string attribute for displaying the image whose filename is taken from
the attribute contents. The image field is put above the string field.
If you don't check this item then the settings
of the fields `Title at string field', `Hide string field',
and `Size' are meaningless.
- a field `Title at string field'. If checked, the title of the attribute object
is placed to the left of the string field, thus the image field gets more space in the window.
If you don't check this field then the title is placed to the left of the image field.
- a field `Hide string field' for removing the string field from the user interface.
If checked, only the image field is displayed.
- a field `Size' for specifying how size-handling is done for the image area.
If `Resize-able' is active then the object can be resized and the
object can become larger than the size of its image.
`Fixed' sets the object's size to the size of the image.
If the image sizes vary from record to record then the object is resized accordingly.
`Scroll-able' adds two scrollers to the object allowing to view images
that are larger than the visible region.
If `Scaled' is activated then the image is scaled to the size
of the display object.
- a field `File pop-up' that, if checked, adds a pop-up button
to the right of the string field. This buttons serves to open a file requester
for choosing a filename.
- a field `Font pop-up' for adding a pop-up button that opens
a font requester. This feature has been added according to a suggestion
from Ralphie. Blame him if you find this feature useless. :-)
- a field `List-view pop-up'. If checked, a pop-up button is
attached to the right of the string field for opening a list-view pop-up
where you can choose a string from a list of strings.
The list of strings can be specified in the label editor which is opened
after pressing the `Edit labels' button to the right of the
`List-view pop-up' field. For more information about the
label editor, see section Label editor.
Only one of the fields `File pop-up', `Font pop-up' and
`List-view pop-up' can be made active (MUI programmers know why).
- a field `View' that, if checked, adds a button to the right of the string field
for launching an external viewer with the attribute contents as argument.
This can be useful if you store filenames in the attribute and want to display the
contents of a file by starting an external viewer.
The external viewer can be specified in menu item `Preferences - External viewer'
(see section External viewer).
- for attributes of type choice there is a field `Kind'
where you choose whether the attribute contents should be displayed
by a `Cycle button' or by a set of `Radio buttons'.
If you select `Cycle button' then you can set the title position
to one of `Left', `Right', `Top', or `Button'.
If you select `Radio buttons' then two check mark items
`Frame' and `Horizontal' allow drawing a border around
the radio buttons and the specification of an horizontal layout.
- for attributes of type real there is an integer field `Num decimals'
where you can enter the number of decimals for displaying the floating point values.
- for reference attributes there is an `Extras' page that contains the
following items:
- a list-view field `Contents' where you specify which contents of a referenced
record should be displayed. You can multi-select several items in this list.
If you select `Record number' than the record number of a referenced record is
included in the display. The other items are the names of attributes in the referenced table.
- a text field `Items selected' that displays how many items have been
selected in the above list-view.
- a field `Show'. If checked then the gui object for displaying the
reference is created as a button. Clicking on this button will show you the
referenced record in the table mask of the referenced table.
- a field `Filter' that, if checked, adds a button to the right of the
reference field for turning on and off the reference filter for this attribute.
See section Reference filter, for more information about reference filters.
- for virtual attributes the attribute object editor contains:
- a choice field `Kind' where you specify how the contents of the virtual attribute
should be displayed. You can choose between `Bool' that uses a check-mark field
for displaying boolean values, `Text' that uses a text field for displaying one
line of text (including date, time, and numerical values), and `List' which uses
a list-view for displaying a list of lines (e.g. the result of a select-from-where query).
- if you set the `Kind' field to `Text' then two further fields are
available: `Format' for specifying how the attribute contents should be presented
and `Num decimals' for entering the number of decimals that should be used
if the attribute contents are of type real.
- if the `Kind' field has been set to `List' then a field `Show titles'
is available. If checked, the first line of the attribute contents is displayed as
a title row in the list-view. Otherwise no title row is displayed and the first line
is ignored.
- a field `Immediate' that, if checked, causes the virtual attribute to recompute
its value whenever you switch the active record to another one.
If not checked then the value of the virtual attribute is only computed when a MUIbase program
needs its value, e.g. when you have installed a button somewhere in the user interface
that reads the value of the virtual attribute when the button is pressed.
- For buttons there are the following additional fields:
- a choice field `Kind' where you choose between `Text button' and
`Image button'.
- if you set the button kind to `Text button' then further fields
`Title', `Font', `Background' and `Default' appear for
entering the text to be displayed in the button, the font used for
displaying the text, and the background settings.
- if the button kind has been set to `Image button' then a field
`Image' for specifying the image to be displayed and
a field `Size' for specifying the size-handling of the image button
are offered.
When you add a text object to the display list-view, or when you change one
by double clicking on it, a window `Text' is opened. This window
contains the following items:
- a string field `Title' for entering the text that should be displayed.
- a numerical field `Weight' for specifying the horizontal
weight of the text object.
- a choice field `Font' for specifying the font of the text.
If you leave this field empty, a default font is used.
- two fields `Background' and `Default' for specifying the
background settings of the text object.
- two buttons `Ok' and `Cancel' for leaving the window.
When you are done with all settings, press the `Ok' button to leave the window.
The image editor appears when you add a new image object or double click on
an existing one. It contains the following items:
- a field `Weight' for specifying the weight of the image object in
the final window layout.
- a field `Image' for specifying the image that should be displayed.
- a field `Size' where you specify how resize-handling should be done.
If you select `Resize-able' then the image object can be resized.
`Fixed' sets the object size to the size of the displayed image.
- two buttons `Ok' and `Cancel' for leaving the window.
When you are done with all settings, click on the `Ok' button
to close the window.
After you have added a space object to the display list-view, you can
change its default settings by double clicking on it.
This will open the `Space' window containing the following items:
- a field `Delimiter' that, if checked, displays a vertical or horizontal bar
(depending on the layout of the parent object) in the center of the space object.
This is useful for separating parts in the window layout.
- a numerical field `Weight' for specifying the weight of the object.
- two fields `Background' and `Default' for specifying the
background settings.
- two buttons `Ok' and `Cancel' for leaving the window.
After you are done with all settings, press the `Ok' button to close the window.
After you have added a group object to the display list-view, you can change
its settings by double clicking on it. This will open the `Group' window
offering the following items:
- a string field `Title' for entering a title string that should be
displayed centered above the group. If you leave this field empty then
no title is displayed.
- a numerical field `Weight' for specifying the weight of this object.
- two fields `Background' and `Default' for specifying the
background settings.
- a field `Border' that, if activated, draws a border frame around the group.
- a field `Horizontal'. If checked, the layout of the group is done
horizontally and the group is listed in the display list-view as `HGroup'.
Otherwise the group is organized vertically and the display list-view will show
a `VGroup' for this group.
- a field `Spacing' that, if checked, adds some space between the group's
child objects. Otherwise no space is put between the objects.
- two buttons `Ok' and `Cancel' for leaving the window.
When you are done with all settings, press the `Ok' button to leave the window.
Double click on a register group object in order to change its settings.
This will open the `Register group' window
offering the following items:
- a numerical field `Weight' for specifying the weight of this object.
- two fields `Background' and `Default' for specifying the
background settings.
- an area `Labels' for specifying the label of each register page.
You should specify exactly the same number of labels as there are
elements in the register group. For more information on how to
enter and edit the labels, see section Label editor.
- two buttons `Ok' and `Cancel' for leaving the window.
When you are done with all settings, press the `Ok' button
to leave the window.
To change the settings of a window object, double click on it.
This will open the window editor containing the following items:
- a string field `Title' where you enter a string that should be displayed
in the window title bar and in the window button.
- a string field `Shortcut' where you enter the shortcut for
activating the window button.
- a numerical field `Weight' for specifying the weight of the
window button.
- a field `Font' for selecting the font of the window button.
If you leave the field empty, a default font is used.
- two fields `Background' and `Default' for specifying the
background settings of the window button.
- a field `Disabled' that, if checked, creates the window button
with a disabled state, that is, you can't click on it and therefore
cannot use it to open or close the window.
This can be useful if you don't want the user to open windows by himself
but want to open them from within a MUIbase program.
- two buttons `Ok' and `Cancel' for leaving the window.
When you are done with all settings, press the `Ok' button to close the window.
Sometimes it is useful to get an overview of all tables and attributes of a project,
e.g. when you want to write a MUIbase program.
You can do this by selecting menu item `Project - Print structure'.
This will ask you for a filename where the list of tables and attributes
should be written to.
The output will first list the project name, followed by all tables in this project.
For each table all attributes including their types are listed.
Go to the first, previous, next, last section, table of contents.