DBGrid tracking? 
Author Message
 DBGrid tracking?

Hi,
Is there any way to have tracking with the scrollbars in a dbgrid?
I cannot seem to manage it.
Regards
Johan Smit


Wed, 18 Jun 1902 08:00:00 GMT  
 DBGrid tracking?
Hi!

Use (Table/Query).FetchAll


Quote:
>Hi,
>Is there any way to have tracking with the scrollbars in a dbgrid?
>I cannot seem to manage it.
>Regards
>Johan Smit



Wed, 18 Jun 1902 08:00:00 GMT  
 DBGrid tracking?
Do you mean that the scrollbar thumb position should correspond to the
actual position in the database ?
This only works for dataset of which Delphi can determine the RecordNumber.
This is only the case for dBase or Paradox tables with sorted on a unique
index.



Quote:
> Hi,
> Is there any way to have tracking with the scrollbars in a dbgrid?
> I cannot seem to manage it.
> Regards
> Johan Smit



Wed, 18 Jun 1902 08:00:00 GMT  
 DBGrid tracking?
On Thu, 15 Jun 2000 18:17:06 +0200, "M.H. Avegaart"

Quote:

>Do you mean that the scrollbar thumb position should correspond to the
>actual position in the database ?

Yes, I mean that while you move the scrollbar, the records should
move.

Quote:
>This only works for dataset of which Delphi can determine the RecordNumber.
>This is only the case for dBase or Paradox tables with sorted on a unique
>index.

That is what I have.

Quote:
>Use (Table/Query).FetchAll

Thank you, I will try that. The Query only fetches enough records to
fill the visible part of the grid? Then it follows that scrolling will
not be possible. Fetching all should enable it then. Thank you.
Regards
Johan Smit


Wed, 18 Jun 1902 08:00:00 GMT  
 DBGrid tracking?
On Thu, 15 Jun 2000 18:32:05 +0400, "Nick Melnick"

Quote:

>Use (Table/Query).FetchAll

No, still does not work.
I would like the dbgrid to scroll while dragging the scrollbar with
the mouse.
It still waits for the mouse button release to scroll.
Any suggestions?
Thank you
Regards
Johan Smit


Wed, 18 Jun 1902 08:00:00 GMT  
 DBGrid tracking?
Try something like this:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Grids, DBGrids;

type
  TForm1 = class(TForm)
    DBGrid1: TDBGrid;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure AppMessage(var Msg: TMsg; var Handled: Boolean);
  private
    { Private declarations }
    OldAppMessage: TMessageEvent;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  { Replace application message handler }
  OldAppMessage := Application.OnMessage;
  Application.OnMessage := AppMessage;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  { Restore application message handler }
  Application.OnMessage := OldAppMessage;
end;

procedure TForm1.AppMessage(var Msg: TMsg; var Handled: Boolean);
begin
  { If vertical scrollbar thrumb track message for DBGrid then }
  if (Msg.hwnd = DBGrid1.Handle) and (Msg.message = WM_VSCROLL) and
    (LongRec(Msg.wParam).Lo = SB_THUMBTRACK) then
    { Replace by thumb position message }
    LongRec(Msg.wParam).Lo := SB_THUMBPOSITION;
end;

end.



Quote:
> On Thu, 15 Jun 2000 18:32:05 +0400, "Nick Melnick"

> >Use (Table/Query).FetchAll
> No, still does not work.
> I would like the dbgrid to scroll while dragging the scrollbar with
> the mouse.
> It still waits for the mouse button release to scroll.
> Any suggestions?
> Thank you
> Regards
> Johan Smit



Wed, 18 Jun 1902 08:00:00 GMT  
 DBGrid tracking?
Hi,
Thank You

On Fri, 16 Jun 2000 14:10:33 +0200, "M.H. Avegaart"

Quote:

>Try something like this:
snip
>procedure TForm1.AppMessage(var Msg: TMsg; var Handled: Boolean);
>begin
>  { If vertical scrollbar thumb track message for DBGrid then }
>  if (Msg.hwnd = DBGrid1.Handle) and (Msg.message = WM_VSCROLL) and
>    (LongRec(Msg.wParam).Lo = SB_THUMBTRACK) then
>    { Replace by thumb position message }
>    LongRec(Msg.wParam).Lo := SB_THUMBPOSITION;
>end;

I do not understand it.
Because I had no result, I changed to:
 if (Msg.hwnd = DBGrid1.Handle) then if  
  (Msg.message = WM_VSCROLL) then if //line a
(LongRec(Msg.wParam).Lo = SB_THUMBTRACK) then //line b
    LongRec(Msg.wParam).Lo := SB_THUMBPOSITION;
With a breakpoint on Line a, the program halts repeatedly with all
sorts of Msg.Message, except WM_VScroll  (=277).
A breakpoint on line b never halts the program.
There is never a WM_VSCROLL msg.message.
Yet the program behaves as normal. The BDGrid scrolls when the mouse
button is released.
Quote:
>This only works for dataset of which Delphi can determine the RecordNumber.
>This is only the case for dBase or Paradox tables with sorted on a unique
>index.

I think I missed something here. Part of the SQL is 'order by Num'
where Num is the primary index. I am now confused. How to 'sorted on a
unique index' in a SQL query? There are also two fields from another
table in the same sql query, one the relational field, an one
additional field. Perhaps that is the problem. Yet the API calls to
WM_VSCROLL should work?

Any suggestions?
Regards
Johan Smit



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. DBGrid Memo handling and thumb tracking

2. Database structure version tracking

3. Tracking duplicate records?

4. Keeping track of seat available

5. Validation mess - Totally wrong track?

6. How to track database activity?

7. special problem with audio track length

8. PR-Tracker v2.03 -- Tracks problem reports, bugs, defects

9. Tracking Resources

10. PR-Tracker -- Tracks problem reports, bugs, defects

11. I need help for playing CD track and .wav file on MS-DOS mode

12. PR-Tracker -- Tracks problem reports, bugs, defects

 

 
Powered by phpBB® Forum Software