Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DBNavigator Insert vs Append

128 views
Skip to first unread message

Tony

unread,
Oct 10, 2005, 9:55:32 AM10/10/05
to
Hi All,

I have an app that comprises a DB Grid and a DBNavigator. The app is
essentially a 'log' based on a timestamp key field.
With D5 pro and using a DBNavigator I need to append a new record rather
than inserting one (simply because I need visually for the cursor/record to
go to/at the end of the log).
The DBNav does not have an append button so how can one add one or over-ride
the existing Insert key (and associated hint) to perform this function?

Regards,


Kittipong Kiatcheeranun

unread,
Oct 10, 2005, 5:08:51 PM10/10/05
to
The easiest way you can do like this:

procedure TForm1.DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
begin
if (Button = nbInsert) then
begin
Table.Append;
end;
end;

Best Regards
Kittipong Kiatcheeranun


"Tony" <pols...@yahoo.com> wrote in message
news:434a...@newsgroups.borland.com...

Tony

unread,
Oct 10, 2005, 11:21:35 PM10/10/05
to
Thanks Kittipong,

I had considered this approach but wondered if it would over-ride the
standard DS.Insert or the DS.Insert would fire followed by the DS.Append -
and the consequencies thereof.

Regards,
Tony

"Kittipong Kiatcheeranun" <kk_t...@hotmail.com> wrote in message

Kittipong Kiatcheeranun

unread,
Oct 11, 2005, 7:20:46 AM10/11/05
to
> I had considered this approach but wondered if it would over-ride the
> standard DS.Insert or the DS.Insert would fire followed by the DS.Append -
> and the consequencies thereof.
>

You can override BtnClick method in DBNavigator class too. If you have a
look in TDBNavigator class
the BtnClick procedure is virtual method declaring in the public section.

Have a look at TDBNavigator class in DBCtrls.pas, you will get an idea. :)

Regards
Kittipong Kiatcheeranun


John Herbster

unread,
Oct 11, 2005, 9:24:47 PM10/11/05
to

"Tony" <pols...@yahoo.com> wrote

> With D5 pro and using a DBNavigator I need to append a
> new record rather than inserting

Tony, I am a little concerned that you may be misusing the
concept of a database table. Only a few table types will
allow you to specify the logical position of the new record
by means other than the sort order of its contents, relative
to what is already in the table. If you want to specify the
position of a new record in a TDBGrid before and after its
posting, then I suggest that you research other methods
beyond Append and Insert. Regards, JohnH

Tony

unread,
Oct 12, 2005, 2:02:05 PM10/12/05
to

"John Herbster" <herb-sci1_AT_sbcglobal.net> wrote in message
news:434c6463$1...@newsgroups.borland.com...

Hi John,

The application is a data logging one (grid type) with the primary key the
date and time of entry (i.e. Timestamp). 'Logically' (if there is such a
thing) the operator needs to add the latest entry at the end of the log. If
one 'hits' 'Last' one goes to the end of the grid (last record) but hitting
Insert inserts the new record prior to the previous entry - which is
disconcerting to the user (and me!). OK, so one could hit the down arrow key
to achieve the same result and even if one does issue an insert, refresh
will sort out the grid 'appearance'.
In reality all I'm trying to do is make the grid 'list' look normal - new
entries are added to the end, just like a manual data 'record book'. I'm
dealing with fairly non-computer literate users (and myself as casual
programmer!)
BTW, I'm using Firebird as the DB.

However, thanks for the concern shown, it is appreciated.


0 new messages