I'm trying to create a simple user interface for a small database using OpenOffice.org Base (backed by a Postgres database). In several places in this database, I have many-to-many relationships, implemented with a cross-reference table. Thus:
Book BookEditorX Editor
id 1 -------- M bookid
title editorid M -------- 1 id
etc... name
etc...
What I would like to do for adding records is to have a form for
adding books, on which there is a field, two list boxes, and two
buttons:
Field1: Type in here to limit the values in ListBox1
ListBox1: Shows a (processed) list of editor names matching the string
in Field1, if the string is 3 characters or more, or
nothing otherwise.
ListBox2: Shows the list of editors associated with the book being entered
Button1: Removes an editor from the book
Button2: Adds the editor selected in ListBox1 to the book
I'm having some difficulty building an interface which looks like
this, however. So much so, in fact, that I feel I must be missing some
simple structure or paradigm.
I've managed to get ListBox2 working using nested Forms and a
TableControl. Button1 also works to remove editors from the current
book, with quite some effort to find the appropriate parts of the API.
However, in writing the search-as-you-type macro for Field1 and
ListBox1, the text I want to display in the ListBox is not suitable
for specifying a unique record in the Editors table; thus, I need some
additional data storage in the ListBox to map an item in the list to
the relevant Editor.id value. I can't find a way of doing this -- the
ListBox control seems only to hold a single string value in each list
item.
So, my questions:
1) Do I have the right idea for the user interface?
2) Is there some easier way of implementing this type of data entry
structure than the one I've chosen?
3) How do I deal with the limitation of the ListBox where I can't seem
to store more than just the displayed string?
4) On a more general note, if the answer to (2) is "no", then why not?
This sort of structure is going to turn up in any but the most
trivial of databases. Making developers reinvent a (fairly complex)
wheel for every non-trivial database seems somewhat sub-optimal.
Hugo.
--
=== Hugo Mills: [EMAIL PROTECTED] carfax.org.uk | darksatanic.net | lug.org.uk
===
PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
--- "It was half way to Rivendell when the drugs began to take ---
hold" - Hunter S Tolkien, "Fear and Loathing
in Barad D�r"
signature.asc
Description: Digital signature
