[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Scrollbar in DBGrid (Delphi 3)

Posted on 1997-07-25
Medium Priority
Last Modified: 2009-07-29
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 ?
Question by:PhiNet
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3

Author Comment

ID: 1339770
Edited text of question

Expert Comment

ID: 1339771
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.

Author Comment

ID: 1339772
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.

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Accepted Solution

millerw earned 200 total points
ID: 1339773
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.


Hope you have more progress that everyone else,

Expert Comment

ID: 1339774
Here is Borland's solution to removing the scroll bar that is there:
unit Newgrid;


  WinTypes, WinProcs, Classes, DBGrids;

  TNoVertScrollDBGrid = class(TDBGrid)
    procedure Paint; override;

procedure Register;


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

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


Here is one that works with Paradox tables: (TScrollDBGrid)

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.


Expert Comment

ID: 1339775
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.


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.  


Author Comment

ID: 1339776
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.


Expert Comment

ID: 1339777
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,

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question