Recent

Author Topic: TDBNavigator  (Read 6407 times)

ilniko

  • New Member
  • *
  • Posts: 18
TDBNavigator
« on: March 24, 2006, 08:37:10 pm »
Hi all,
sorry my ignorance, but I don't know how to stop the execution of a Button Action in a TDBNavigator.
I've tried calling the ExecuteCancelAction in the BeforeAction event, but nothing to do.

Nik

matthijs

  • Hero Member
  • *****
  • Posts: 537
RE: TDBNavigator
« Reply #1 on: March 25, 2006, 11:02:40 am »
What do you want to cancel?
Actions on the database you should cancel in events of the dataset. So if you are using a TSQLQuery and you want to cancel the posting of data you should do the cancellation in the BeforePost event.
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

ilniko

  • New Member
  • *
  • Posts: 18
TDBNavigator
« Reply #2 on: March 25, 2006, 11:19:28 am »
I use a TDbf.
So I have to call the ExecuteCancelAction in the BeforePost event of the TDbf, to cancel the post? Or whatelse I have to call to do it?

Nik

matthijs

  • Hero Member
  • *****
  • Posts: 537
TDBNavigator
« Reply #3 on: March 25, 2006, 12:50:00 pm »
No, you just call DataSet.Cancel
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

ilniko

  • New Member
  • *
  • Posts: 18
it doesn't work
« Reply #4 on: March 25, 2006, 01:34:20 pm »
I've tried your suggest, but it doesn't work. The dataset try however to post data in the dbf.
Here's my code:
Code: [Select]

procedure TFMain.DbfPrevBeforePost(DataSet: TDataSet);
begin
  if DbfPrev.FieldByName('pdata').AsString = '' then
    DataSet.Cancel;
end;


Posting data with the "pdata" field blank, cause a Key Violation on the table index, and even if the DataSet.Cancel is executed, the error message is shown anyway, so i suppose that the Cancel did not work.

matthijs

  • Hero Member
  • *****
  • Posts: 537
RE: it doesn
« Reply #5 on: March 25, 2006, 03:20:27 pm »
What if you change code to:
Code: [Select]

procedure TFMain.DbfPrevBeforePost(DataSet: TDataSet);
begin
  if DbfPrev.FieldByName('pdata').AsString = '' then
    DbfPrev.Cancel;
end;
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

ilniko

  • New Member
  • *
  • Posts: 18
TDBNavigator
« Reply #6 on: March 25, 2006, 03:35:58 pm »
I've just tried with DbfPrev.Cancel before of DataSet.Cancel and I obtained the same result: the dataset post data anyway.
Maybe there is a problem in the DBNavigator?

matthijs

  • Hero Member
  • *****
  • Posts: 537
TDBNavigator
« Reply #7 on: March 25, 2006, 05:24:34 pm »
No, the DB Navigator got nothing to do with this. All the Navigator does is calling methods from the dataset it is connected to.
Is the BeforePost called at all? You could test this by showing a message or something like that.
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

ilniko

  • New Member
  • *
  • Posts: 18
TDBNavigator
« Reply #8 on: March 26, 2006, 01:33:09 pm »
Yes, I called the BeforePost. Not sure if the Cancel procedure was called, the first thing I do was be put a ShowMessage, and the dialog appear correctly.
Maybe then the problem is in the TDbf component, that not process correctly the Cancel procedure.

I'm thinking to do a Frame with the buttons Add, Delete, etc, and do from myself the code for Insert, Delete, Post, Cancel, etc.

 

TinyPortal © 2005-2018