programmable relational database
with graphical user interface
Below documentation is part of the MUIbase dictribution and is also available in PDF.
The making of a family-tree database.
This chapter contains a brief tutorial describing the basic usage of MUIbase. Within the tutorial a small project is developed that allows the managing of your family tree. The project that results after applying all steps in this tutorial can be found as the `FamilyTree.mb' project located in the `Demos' directory of your MUIbase installation.
4.1 How MUIbase Works
MUIbase could be said to operate in two different modes, record-editing and structure-editing mode.
The record-editing mode is where you add, change, or delete records.
The structure-editing mode lets you edit how your database should look like and what tables and attributes it contains.
Besides this there is the program editor where you enter program functions that are executed automatically when entering data or explicitly when pressing a program button.
4.2 Starting with a Project, the Structure Editor
To create a database you first need to define it's contents. In MUIbase this is done in the structure editor which is opened by choosing `Structure editor' in the `Project' menu. Here you find three different sections:
4.3 Adding a Table
First we need a table, press the `New' button just below the list view in the `Table' section. You will then see a dialog which asks you to enter some data:
When this is done, just press the `OK' button and we have our first table, `Person'.
4.4 Adding an Attribute
Then we need a string attribute for that table, press `New' in the attributes section. Attributes also need some settings:
4.5 Displaying the Project
After pressing `OK' you now should notice some changes in the display section. Change the choice button on the top of the display section to `Main window'. There you see what the main window holds, currently only table `Person'. If you change the choice button back to `Table mask', you can see how table `Person' is presented. Currently it's displayed as one panel with one attribute.
Now double-click on `Person' at the top of the list in the display section and a window should appear. Click on the `Panel' tab and you can set how the panel of the table should be displayed:
Press `OK' and then double-click on `Name' in the list-view in the display section. This brings up the window that contains the settings for how to display the string attribute `Name'.
Leave the structure editor (choose `Exit structure editor' in the `Project' menu) and you are back to record-editing mode where you see how the database really looks like. You'll see the headline which is the string you may have entered in the display section for the panel. The record counter should say `#0/0' since we haven't added any records yet. Thereafter is a filter button and two arrow buttons. Below all this you should have the `Name' attribute with the text you may have entered in the display section for this attribute. If you haven't changed any text at all when in the display section then the panel should be named `Person', and the string attribute `Name'. Move the mouse above the string attribute `Name' and leave it there for a couple of seconds. If you entered something in the bubble help above then this text should appear in a popup window.
4.6 Adding two Reference Attributes
Now we will add two reference attributes. Reference attributes are a bit different than other attributes. As their name might imply they refer to records. This will become more understandable as you try it out for yourself in just a while.
Enter the structure editor again and add two more attributes to table `Person'. Press `New' in the attributes section, name it `Father', and change it's type to `Reference'. A reference attribute has only one setting:
Add another attribute by pressing `New' in the attribute section and call it `Mother'. The attribute's type should also be set to reference and point to table `Person'.
As you may have noticed, there are now three attributes in the display section. Click on `Father' and then on the buttons up and down located just to the left. This will change where `Father' is positioned when looking at it while in record-editing mode. Put `Father' at the top, `Name' in the middle, and `Mother' at the bottom.
Next, we specify what contents the reference attributes `Father' and `Mother' should display from the referenced records. Double-click on `Father' in the display section and then click on `Extras'. Here we choose to display the string attribute `Name', then we press `Ok' and repeat the procedure for `Mother'.
4.7 Adding Records
Now we should add some records. Leave the structure editor and enter record-editing mode. To add a new record you choose `New record' from the `Table' menu (on Windows and Linux you find this menu by pressing and holding the right mouse button inside the table mask). The cursor should now automatically jump to the attribute we have set to `Home' earlier in the display section in the structure editor. Add two records, one with your fathers name in `Name' and another one with your mothers name in `Name'. Thereafter you add another record with your own name in `Name'.
Now it's time to understand those reference attributes. By pressing on the list-view button on `Father' we get a list of all records this reference attribute could refer to. Choose your fathers name and do accordingly down below on the mothers list-view.
Now you should have three records, you, your father and your mother. In your record, your fathers name should be visible in `Father' at the top and your mothers name should be in `Mother' at the bottom. You can browse through the records by pressing Alt together with the cursor keys Up and Down.
But hey! My parents also has/had parents you say! So let's add another four records, the third generation. Just add the records one by one and write their names in `Name'. If you don't remember their names then just enter `father's father', `mother's father' or something like that instead. Then you browse through all the records and set `Father' and `Mother' to what they should contain. When this is done you should have at least seven records, your record, your parents records and your grandparents records.
Since we now have some records to work with, we could try out the filter function. The filter can sort out records you don't want to display, they will still remain in the database but they are just not displayed anymore.
To edit the filter you choose `Change filter' from the `Table' menu. A window with loads of operators will appear. This is where you set what conditions a record must fulfill to get displayed.
In this small example we will use the
Press `Ok' and you may notice that records with no `a' in `Name', no longer are visible. Since the letter `a' is quite common in most languages and names, all records might still be visible but you can try other letters to make the filter function more clear.
As mentioned earlier there is a button on the panel that says `F'. This `F' indicates if the filter is on or off. Finally when you're done testing, turn the filter off so that all records are visible.
Now that we have played with the filter function a bit, we turn to the query feature of MUIbase. Queries can be used to display information from a database matching certain criteria.
Choose `Queries' from the `Program' menu to open the query editor. Now a window with some buttons on the top and two larger areas below appear. The string to the upper left is where you enter the name of what you want to call the query you make.
The first large area is where you enter the query. The second large area is where the result is displayed.
Now let's produce a list of all those persons we tried to filter out previously. Type `Persons with an a in their name' in the string to the upper left. This is the title for this query. In the upper large area, type:
Now when you run this query by pressing the `Run' button it will produce a list of all persons with the letter `a' in their name. Try changing the letter to see different results.
At this time we can introduce the
Note that we are still using the
4.10 Adding a Table with a Memo and a Button Attribute
These were two ways of selecting and displaying the database. Another way of displaying data can be done by a program. In order to display data we can use an attribute type called memo.
Enter the structure editor and press `New' in the table section. Name the new table `Control' and set it's number of records to `Exactly one'. Click and hold down the mouse button on the new table. Now drag it just a bit above the middle of table `Person' and release the button. In the table section, `Control' should now be on top, followed by `Person' below.
Make sure that table `Control' is selected, then press `New' in the attribute section. Set the type of the new attribute to `Memo' and give it the name `Result'. Press `Ok' and then add another attribute to table `Control' by once again pressing `New' in the attribute section. This time, set it's type to `Button' and name it `Pedigree'.
To give the database a better look, click once on `Pedigree' in the display section and push it to the top by pressing the `Up' button once.
4.11 Programming MUIbase to do a Pedigree
Now we have a button that can start a program and a memo to display data in. It's therefore time to enter the program editor. This is done by choosing `Edit' from the `Program' menu. The editor has three buttons:
As all program functions you write will reside in this one window,
we will need to separate them from each other.
In MUIbase this is done by the
With this in mind we now type in the first function
which will produce a family tree of the current person
in the database and place the result in attribute `Result'.
When typing this program, make sure that all the parenthesis are where they should be. Too many or too few parenthesis is the most common error you get when MUIbase is compiling your program. The error message from MUIbase probably is `Syntax Error' in this case. Press `Compile & close' and the window closes, which means that there weren't any mistakes during compiling.
Don't worry too much if you don't understand all the functions at first. There is a complete chapter (see Programming MUIbase) containing a reference of all functions including their detailed descriptions.
Now we have a program to run, but first we have to assign the program function
to the `Pedigree' button.
This is done by entering the structure editor, selecting `Control'
in the table section and double-clicking on the `Pedigree' attribute
in the attribute section.
Then open the list-view `Trigger'.
In this list, all your program functions will be listed,
currently there should be three functions:
Now if everything is done correctly, pushing the `Pedigree' button will produce a pedigree of the current person. Try changing person to see some different pedigrees.
4.12 Programming MUIbase to List a Person's Children
As the next addition to this database requires some more records, you should add your brothers and sisters. If you don't have any then write `My faked sister 1', `My faked brother 1' which of course should be set to have the same parents as you have.
Then go to the program editor and type the following for creating another program.
To create variables, we use the
All we need to execute this program is a new program button.
Therefore, enter the structure editor and add a button attribute
in table `Control'.
Call it `Children' and choose
To bring some order in the mask of table `Control' it's now time to introduce groups. All objects can be ordered into vertically or horizontally aligned groups.
In the display section, click on `Pedigree' and shift-click on `Children', thereafter you click on the `Group' button to the left. Now the two program buttons will be together in a vertically aligned group. However, we want this one to be horizontally aligned so double-click on the `VGroup' that has appeared in the display section. This will open a window that lets you change the settings for this group. Set the title to `Programs' and check the `Horizontal' button.
At this time we can hide the name of attribute `Result' in table `Control'. Double-click on `Result' in the display section and empty the title field. This will display attribute `Result' without any title string.
To make things easier, if we add more programs or attributes in table `Control', we should place `Result' and the `Programs' group into a vertical group. Be sure that you have only marked `Programs' and `Result' then press `Group'. This places `Programs' and `Result' into a vertical group.
Leave the structure editor and take a look at the result. Then press the `Children' button to see the number of children and their names of the current person.
This example could very well be extended into a fully-grown pedigree program. The only real limits are your fantasy and the size of your hard drive.
This document was generated on Oktober, 10 2017 using texi2html