?
Solved

Scrollbar in DBGrid (Delphi 3)

Posted on 1997-07-25
8
Medium Priority
?
3,056 Views
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 ?
0
Comment
Question by:PhiNet
[X]
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
8 Comments
 

Author Comment

by:PhiNet
ID: 1339770
Edited text of question
0
 
LVL 2

Expert Comment

by:icampbe1
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.
0
 

Author Comment

by:PhiNet
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.


0
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.

 
LVL 1

Accepted Solution

by:
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.

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

Hope you have more progress that everyone else,
Scott
0
 
LVL 1

Expert Comment

by:millerw
ID: 1339774
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
 
LVL 1

Expert Comment

by:millerw
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.

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
 

Author Comment

by:PhiNet
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.

0
 
LVL 1

Expert Comment

by:millerw
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,
Scott
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

765 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