Subject OnLoseFocus question
Author guido.klapperich@t-online.de
I want, that when the user has done some changes to a dataset and he
wants to change the focused datasource, he will be asked to confirm his
changes. I have 2 DataSources with AnnounceFocus and AllowFocus set to
true and the following OnLoseFocus-Event for both DataSources:

procedure TForm1.CSDataSourceLoseFocus(Sender: TIB_DataSource;
ADataset: TIB_Dataset);
var MResult: Word;
begin
if ADataset.NeedToPost then
begin
MResult:=MessageDlg(ADataset.Name+' Save
?',mtConfirmation,[mbYes,mbNo,mbCancel],0);
if MResult=mrYes then
ADataset.Post
else if MResult=mrNo then
ADataset.Cancel
else if MResult=mrCancel then
Abort;
end;
end;

When the user clicks on Yes or No the MessageDialog appears twice und
then raises the exception 'Can't post/Cancel current Row'. When the user
clicks on Cancel the Dialog appears every time again.
What am I doing wrong ?


Guido