next up previous contents index
Next: 2.5 Learn by doing Up: 2 Developing an nxqddb Previous: 2.3 Adding some final

2.4 Redesigning the interface using QddbScript

You can use QddbScript to change the look of your addressbook. Just to give you a gentle introduction to QddbScript, follow these steps to make your AddressBook2 look like the one shown in figure 2.14.

  1. cd  /Databases
  2. qddbscript autogen AddressBook2
  3. vi AddressBook2/QddbScript
  4. nxqddb AddressBook2

Line 1 places you in your Databases directory that contains your AddressBook2 relation. Line 2 runs the qddbscript command to autogen (automatically generate) a QddbScript file contained under the AddressBook2 directory. Line 3 says to edit the QddbScript file. Edit your QddbScript file to look like the one shown in figure 2.13.

[options autoalign]
[frame attr=Name border=3 relief=groove]
[entry attr=Name.First label="First" width=10]
    [entry attr=Name.Middle label="Middle" width=10]
    [entry attr=Name.Last label="Last" width=10]
[end frame]
[frame attr=Address border=3 relief=groove]
    [entry attr=Address.Street label="Street" width=10]
    [entry attr=Address.City label="City" width=10]
    [entry attr=Address.State label="State" width=2 noexpand]
    [entry attr=Address.Zip label="Zip" width=10]
    [entry attr=Address.Email label="Email" width=10]
    [entry attr=Address.HomePage label="Home page"width=10]
[end frame]
[frame attr=Phone border=3 relief=groove]
    [entry attr=Phone.Description width=10]
    [entry attr=Phone.AreaCode width=5 noexpand]
    [entry attr=Phone.Number width=10 noexpand]
[end frame]
[frame border=3 relief=groove]
    [radiobutton attr=Sex value="Male" value="Female" value="Unknown" noexpand]
    [radiobutton attr=Relation value="Relative" value="Friend" 
        value="Colleague" value="Other" noexpand]
    [entry attr=Birthday width=10]
[end frame]
[frame border=3 relief=groove]
    [options noautoalign]
    [text attr=Comments height=4 width=50]
    [code value="pack [=Comments cget -w].f_0 -side top -anchor nw"]
[end frame]

Figure 2.13: Sample QddbSript file for AddressBook2

Figure 2.14: AddressBook2 using QddbScript

Now, when you run nxqddb AddressBook2 the window shown in 2.14 will be displayed. Of course, you can edit the AddressBook2/QddbScript file to rearrange the fields, modify or add new field settings, or even add new Tcl code.

To download a fancier addressbook that uses QddbScript or to see other QddbScript applications, visit

For complete details on how to use QddbScript reference the QddbScript in a Nutshell guide.

Herrin Software Development, Inc.