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
access and change the internal record position
-
AndreyZ
Hello,
You can use bookmarks to return original positions in the following way:This way your customer will not notice anything on a form. If you encounter any problems with this approach, please describe them in details.
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;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
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