Try this Patrick.
Chris
{===========================================================================
=}
unit AppendDBNavigator;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, DB, DbConsts, DBCtrls;
type
TAppendDBNavigator = class(TDBNavigator)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
procedure BtnClick(Index: TNavigateBtn); override;
published
{ Published declarations }
end;
procedure Register;
implementation
procedure TAppendDBNavigator.BtnClick(Index: TNavigateBtn);
begin
{ Note: Do not call the inhertied method because of }
{ the change from INSERT to Append }
if (DataSource <> nil) and (DataSource.State <> dsInactive) then
begin
if not (csDesigning in ComponentState) and Assigned(BeforeAction) then
BeforeAction(Self, Index);
with DataSource.DataSet do
begin
case Index of
nbPrior: Prior;
nbNext: Next;
nbFirst: First;
nbLast: Last;
nbInsert: Append; // Insert;
nbEdit: Edit;
nbCancel: Cancel;
nbPost: Post;
nbRefresh: Refresh;
nbDelete:
if not ConfirmDelete or
(MessageDlg(SDeleteRecordQuestion, mtConfirmation,
mbOKCancel, 0) <> idCancel) then Delete;
end;
end;
end;
if not (csDesigning in ComponentState) and Assigned(OnClick) then
OnClick(Self, Index);
end;
procedure Register;
begin
RegisterComponents('Adrock', [TAppendDBNavigator]);
end;
end.
{===========================================================================
=}
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Patrick Dunford
Sent: Sunday, 16 January 2000 17:23
To: Multiple recipients of list database
Subject: RE: [DUG-DB]: Strange behaviour in DBGrid adding record
You don't get a choice with a DBNavigator.
My fudge is to remove the insert button replacing it with a discrete
bitbutton as follows:
Table.First;
Table.Append;
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Rohit Gupta
> Sent: Sunday, 16 January 2000 14:09
> To: Multiple recipients of list database
> Subject: Re: [DUG-DB]: Strange behaviour in DBGrid adding record
>
>
> Using append instead of insert makes it behave better.
snip
---------------------------------------------------------------------------
New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz