Subject Re: [IBO] Master-Detail Examples
Author Helen Borrie
At 11:09 PM 14/08/2004 +0000, you wrote:
>Dear Helen
>I've compiled and run both the examples you sent me.
>The example using TIBOTables gives me the same problem as I
>described previously.
>If I enter a new Project and complete all it's fields and move
>directly to the grid for Project member without posting the new
>project and enter a team member for the project no problem (at this
>stage neither the New Project nor the team member has been posted)
>Now I move off the new team member into a new row in order to enter
>a second new team member - at this stage the first new team member
>attempts to automatically post - this results in a constraint error
>'Violation of Foreign Key constraint INTEG-41 on table Employee-
>Project' and the post fails.

The FK constraint expects a valid PROJ_ID and a valid EMP_NO.

>If I then click on the nav bar to post the New Project - it posts
>but the new team member disappears.

Then something is strange there. Running it here (Win2K, Delphi 6 Ent.,
with upgrades 1 and 2) you get exactly the same behaviour in both versions:
after the Post (+ Autocommit) the new project is the focused row and the
new members are listed in the lower grid.

Did you remove the KeyLinks?

>Your example using the TIBOQuery works better in that the new team
>member and new project post correctly - but I can only enter One new
>team member in the grid.

There is a "+" button, i.e. a restricted navbar, that you can click to open
a new row when the master is in edit or update mode. Can you see that

Alternatively (default behaviour for the dbgrid) you can tab or down-arrow
past the end of an existing row and Delphi opens a new row (provided the
master is in update or insert mode, of course). Here, it works exactly the
same way with either the table version or the query version.

On "workflow" problem is that, when you add a new detail, the OnNewRecord
handler doesn't do what it's supposed to do the first time around - it
doesn't fire until you actually type a number (any integer) into the EMP_NO
field. When you do, the PROJ_ID is written onto the record automatically,
i.e. no special handler for that. Then you can go to the "Members"
selector and select a valid employee. You'll see the selected employee's
EMP_NO in the grid, and the name in blue to the right of the grid.

Did you modify something?

>Using Delphi 7.1 FB1.5.1 IBO 4.3A

I'm using IBO 4.3Ab.

What OS are you running?

I've got to go out shortly, but I'll capture screen shots of before and
after and upload them.
I'm interested to see whether you see what I see, because someone else had
a problem with bars not displaying correctly in Win Server 3000 when
compiling in Delphi 6. Applying the D6 Upgrade pack 2 fixed that
problem. I can't test Delphi 7.