access and change the internal record position

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
inageib
Posts: 184
Joined: Wed 26 Aug 2009 14:11

access and change the internal record position

Post by inageib » Wed 20 Apr 2011 01:29

Hi,
I need to access and change internal record position for TIBCQuery because I have a master detail tables and in code I used the method disablecontrols;

but after my code execution finish the record position of the master and detail table changes and I need to get back to original location without the user notice flashes or form getting quivered

in disablecontrols mode using locate or gotobookmark is useless so I am looking for a way to change the position internally before I enable controls again

thanks

AndreyZ

Post by AndreyZ » Wed 20 Apr 2011 12:55

Hello,

You can use bookmarks to return original positions in the following way:

Code: Select all

procedure TMainForm.BitBtnClick(Sender: TObject);
var
  bmMaster, bmDetail: TBookmark;
begin
  IBCQueryDetail.DisableControls;
  IBCQueryMaster.DisableControls;
  bmMaster := IBCQueryMaster.GetBookmark;
  bmDetail := IBCQueryDetail.GetBookmark;

  // your code

  IBCQueryMaster.GotoBookmark(bmMaster);
  IBCQueryDetail.GotoBookmark(bmDetail);
  IBCQueryMaster.EnableControls;
  IBCQueryDetail.EnableControls;
end;
This way your customer will not notice anything on a form. If you encounter any problems with this approach, please describe them in details.

inageib
Posts: 184
Joined: Wed 26 Aug 2009 14:11

Post by inageib » Wed 20 Apr 2011 13:15

thanks
I already try this code but in the line that I put my code and due to the nature of the software , it will open a new form and if the user press cancel the position in the master table change

when I tried the bookmark code, I surprised to find a weird action will put in steps:

1- in my code a window open and I use append on the master table
2- user close the form or press cancel
3- record position on the master table move to completely different record
so I used disable controls and position retain.
4- I use gotobookmark to return to original record for both master then detail
5- I get error on the deail table that the record not found - this is because the the position did not actually moved from the master table (the detail table record does not exists in that current record of master table)

5- to work around this I re-enable controls for only master table then I use gotobookmark with the detail table and it work this time without error but the form flashes and also I wait 2-3 seconds before the move occur (I use Firebird)

so I am asking if there is an internal way to move the record position despite the use of disablecontrols method

Thanks

AndreyZ

Post by AndreyZ » Wed 20 Apr 2011 15:12

I cannot reproduce the problem. Please try composing a small sample to demonstrate the problem and send it to andreyz*devart*com, including a script to create and fill tables.

inageib
Posts: 184
Joined: Wed 26 Aug 2009 14:11

Post by inageib » Fri 22 Apr 2011 02:20

email sent, Many Thanks

AndreyZ

Post by AndreyZ » Fri 22 Apr 2011 08:20

I have answered you by e-mail.

Post Reply