Scrollbar in DBGrid (Delphi 3)

I am Using a DBGrid for accessing dBase files (Delphi 3)
It provides a scroll bar during moving in the database
But the scroll-bar only has 3 states (beginn/middle/end)
Therefore I cannot move in the database using the scrollbar.
This also happens with the Demo-Program (CtrlGrid) provided by Borland

Is there a way to make the scrollbar function correctly ?
PhiNetAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PhiNetAuthor Commented:
Edited text of question
0
icampbe1Commented:
You don't say how many rows your grid has.   However, You will find that you have much better control if you drop a DBNavigator on your form and use that.  Delete the buttons you dont want and navigate with the rest.
0
PhiNetAuthor Commented:
The question was not regarding the navigator.

I am using the navigator already.
I can also navigate with cursor buttons up/dwn etc.

BUT: I intend to use my program as my/and others  standard dBase-Browser
And a scroll is a very helpfull tool.

In my opinion my problem is a bug in Borlands Source code

 As mentioned in my question. You may see the same problem with Delphi's CtrlGrid demo.


0
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

millerwCommented:
That is not a bug.  It is a database thing.  

Databases don't return position.  (Dbase are an exception to the rule)  Due to that fact, the scroll bar that is in the DBGrid can only know if it is at EOF, BOF, or not at either one.  That is why you get only 3 positions.  

Additionally, there is a way to do it but, filtering, ordering, or any of that will prevent the scroll bar from returning good data.  Eg.  In ordering you may be on the 3rd ordered record but that record may have record number 234--your scroll bar ends up at the bottom when you are on record 3 only.  It will only work with a TTable that is not ordered or filtered.  TQuery will not work and nothing but a DBASE file will work with the TTable.  

As you can see it is not a Borland bug, it is an Ashton-Tate bug (DBase was made by them) that Borland inherited when they bought them out.  I suggest not doing it at all due to the problems you will most likely run into.  If your tables are Indexed at all, forget the idea--your scroll bar will not show valid data anyway.  

The way to do it if you still persist, is to remove the TDBGird's verical scroll bar and place one of your own to do what you want.  Removing the TDBGrid's scrollbar runs into major problems too.  So you will probably spend a lot of time writing code that you will end of scraping in the end becuase you hate the way it ends up processing.  

Sorry to be so pessimistic but that is the scoop.  If you want to look for yourself, that question fills all the newsgroups.  Goto this site and type in "dbgrid scrollbar" and read about all the problems that arise from trying.

http://www.csd.net/~cgadd/del_srch.htm

Hope you have more progress that everyone else,
Scott
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
millerwCommented:
Here is Borland's solution to removing the scroll bar that is there:
unit Newgrid;

interface

uses
  WinTypes, WinProcs, Classes, DBGrids;

type
  TNoVertScrollDBGrid = class(TDBGrid)
  protected
    procedure Paint; override;
  end;

procedure Register;

implementation

procedure TNoVertScrollDBGrid.Paint;
begin
  SetScrollRange(Self.Handle, SB_VERT, 0, 0, False);
  inherited Paint;
end;

procedure Register;
begin
  RegisterComponents('Data Controls', [TNoVertScrollDBGrid]);
end;

end.

Here is one that works with Paradox tables: (TScrollDBGrid)
http://www.teleport.com/~greglief/delphi.shtml

I've been continuing to look and I did find one on www.delphi32.com but everytime I try to download it, it says NotFound error.

I'll keep looking for you but I'm not sure how much help this will all be to you.  

By the way, that wasn't supposed to be an answer.  I clicked on the wrong radio box.  Reject it if you don't like it.

Scott
0
millerwCommented:
Tried Borland's code and as I feared from reading the newsgroups, you get a flicker of the vert scrollbar with each move of the cursor.  Really sucks.  One suggestion is to make the dbgrid slightly bigger than your panel so that the panel's right edge covers up the scrollbar---sounded interesting.

www.woll2woll.com

That is the home of InfoPower components.  They of course aren't free but they do the scroll bar "correctly."  Check them out if you are still interested.  I personally don't believe in paying money for a bunch of components--I will only pay for source code but want the compiled version free.  

Scott
0
PhiNetAuthor Commented:
Hi Scott!

Your answer is fully correctly. Nevertheless, for my purpose  - using the program as a pure (read only) browser for dBase databases, I found a solution:

I had to add/change Borlands source-code slightly in a way that grids  actually use recordcount  for determing the position of the scrollbar..

If you are interested, I could the mods to you. But please be aware: As you mentioned: no filtering, no orders, that are not indexed.

0
millerwCommented:
Sure, I'm always interested in components or source code.  I'd like to see what you have done.  I think it is probably what I have been thinking but, never know, may be something new that I don't know.  

If you can post it, I'd appreciate it.

Talk to you soon,
Scott
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.