Delphi Apollo: Lightning fast table links without SetRelation()

Delphi Apollo: Lightning fast table links without SetRelation()

Post by Matth » Wed, 20 Nov 1996 04:00:00



Here my solution to making complex table links lightning fast in
Delphi/Apollo when scrolling tables. I'd be interested in feedback.

The challenge:

Two windows show two tables. They are linked by a common field.
However, it is not possible to use the Delphi lookup function. That
would be nice and fast. But for Apollo ttSXNTX this is not supported.
One might use Apollo SetRelation(). However, whatever seek method one
uses, this works like a slug. On a 486, looking up the correct record
in the other table takes 1/10th second. That is SLOW. The user wants
to scroll through the table FAST, not waste time waiting for the
thing.

The issue:

The issue is to update Table2 only when the record pointer in Table1
has moved or when the table is first opened. At all other times,
repositioning the cursor serves only to slow the scrolling display to
a grind. One can test whether the pointer has moved in the TDataSource
OnDataChange() event handler. This "fires" whenever the record pointer
moves. It fires repeatedly on scrolling, however, slowing things down.
The question therefore is how to let the user scoll the table FAST.

My solution:

I did a simple customised TDBGrid. I popped in OnClick(),
OnMouseDown() and OnMouseUp(). So I thought wonderful: I will update
the other table whenever the user STOPS scolling. This is whenever the
user does a OnMouseUp() or OnKeyUp() for the cursor keys 33-40.

If the record pointer is moved by a single mouse repositioning and
click, then the OnDataChange() will cover this and reposition the
other table.

Using OnClick() by itself, without OnDataChange(), would have been
nice, but it does not work. The reason is that the OnClick() seems to
"fire" all the time when scrolling from record to record, even though
the mouse is not even used.

Sadly, I also find this:
- OnMouseUp() works only inside the grid, not when the user presses
the scroll bars of the grid.
- Scrolling is therefore still very slow if the user presses the
"proper Windows buttons" on the scroll bar.
- Trapping OnMouseUp() with TForm's Key   Preview:=true simply does
not seem work!! Could the reason be that the form does not
have active control? It makes no sense, but doesn't work anyway.

However, on cursor keys the scrolling is now very fast. I found I had
to put a public variable flag into the OnDataChange() which turns the
"seek" function "off" while scrolling and "on" when the MouseUp or
KeyUp occurs.

I'd be interested in feedback.

Email appreciated
Matthew

 
 
 

1. Delphi Apollo: Table/datasource link issues

I noticed that the Apollo component seems to take full control of the
table to the exclusion of other DataSource components linked to the
same table. I need to use non-structural indexes in my application for
compatibility reasons.

Who is an Apollo fan and has exprienced the same?

This all means it is not possible to have multiple datasource
components for one table.

The reason is that indexes/setscope set in one Apollo component seem
to affect the table, not the datasource to which it is linked.

If I want different record sets displayed in different windows from
the same table, is it true that I must use two tables - not one table
and two datasources? I'd be very happy if this was not necessary. It
would save me much work and messiness in other parts of my
application.

Anyone who knows Apollo please email me.

Matthew

2. Object extensions Oracle8 - a few questions

3. Delphi:Paradox vs Delphi:SQL Anywhere vs Delphi:FoxPro via Apollo

4. Web assistant error

5. Delphi 3.02 & Foxpro Tables - No Apollo

6. problem with a SQL select request

7. DELPHI 1 : Deployement of SQL Links application without IDAPI.CFG

8. Transactional Replication Immediate Updates Problem

9. Fast Delphi table scrolling: PeekMessage() tricks

10. Can I open NTX index without apollo?

11. how to link SQL Server table to Acces97 without using a DSN

12. call ACCESS 2000 report from SQL server 2000 without link table