Subject Help with dataset only containing one record, the last inserted record, inside the AFTERACTION OF AN IB_UPDATEBAR??
Author Adrian Wreyford
I have the following setup
IB_QueryANIMAL
Select ANIMALNAME, ANIMALID from ANIMAL (simplified)

IB_QueryPHOTOS
Select ANIMALPHOTOANIMALID, ANIMALPHOTO, ANIMALPHOTOID,
ANIMALPHOTOORDER, From ANIMALPHOTO (simplified)

Mastersource of IB_QueryPHOTOS := IB_QueryANIMALDatasource.
Masterlinks: ANIMALPHOTO.ANIMALPHOTOANIMALID := ANIMAL.ANIMALID
RequestLive := True;

4 IB_JpegImages displaying the first 4 records of IB_PHOTOS

I place both on a form, and a IB_Updatebar linked to IB_QueryPhotos
A IB_Navigationbar linked to IB_QueryPhotos,and one linked to
IB_QueryANIMAL.

Now I add a new record to IB_QueryPHOTOS, and post the record using the
IB_updatebar.

I now have the following routine for the AfterAction
procedure TFormPhotoOrganiser.IB_UpdateBar1AfterAction(Sender: TObject);
begin
IF IB_UpdateBar1.FocusedButton = ubInsert then
begin
iF openpicturedialog1.Execute THEN

IB_JPegImageMain.Picture.LoadFromFile(OpenPictureDialog1.FileName);
end
else
IF (IB_UpdateBar1.FocusedButton = ubDelete) then
begin
LoadPhotolist; Here I load a TList with the PHOTOID, and PHOTOORDER
SyncImages; Here I load the four IB_JPEG images with their
respective images.
end;
end;

This all works fine for records that are deleted.
The Tlist is now filled with one record less than before.

Problem now here: If I also check for ubPost in above routine (ie I have
added a new photo, pressed post button, and now want to sync the images
with the new info.)
IF (IB_UpdateBar1.FocusedButton = ubPost) then begin
.Some code to load a tlist with the Sequence of the images, then I
load each of the IB_JpegImages with their respective images in the
correct order.
end;

The IB_QueryPHOTOS, only has one record in it, and that is the Picture
just posted. Say I had 3 pics, and now inserted one more, I would expect
it to now have 4, but only 1 record, the last one inserted.
The Tlist thus only contains one record, and so we get the incorrect
display.
This is not so for when I delete a record.

If I open this same IB_QueryPHOTOS anywhere after this AfterAction
routine has completed, All is well.( It has 4 records in it)
I've been at this for two days.
Closing, and opening the IB_QueryPhotos in the above routine changes
nothing.

I need to sync my display, and the only way to do this, is AFAIS in the
AfterAction of the IB_UpdateBar.
I've tried to limit the code supplied. If it will be clearer I will
supply more info.
Please any suggestions welcomed.
Thanks in advance

Adrian





[Non-text portions of this message have been removed]