Jump to content
Behdadsoft

Fix DBGrid Scrollbar Problem

Recommended Posts

Hi.

I have a DBGrid on my form that contain many rows. the problem is that, scrollbar don't work normally like other programming language. I searched in google for find a solution for this issue but I couldn't find anything. for better understanding, I captured a video from C# DataGridView and Delphi DBGrid that the problem is obvious.
Also I Use Delphi 11.1.

 

Video: Compare C# and Delphi Scrollbar

Share this post


Link to post
51 minutes ago, Behdadsoft said:

scrollbar don't work normally like other programming language

What makes you think the "other" is the normal? For me, it's abnormal.

Share this post


Link to post
21 minutes ago, Attila Kovacs said:

What makes you think the "other" is the normal? For me, it's abnormal.

:classic_mellow:

 

If you select a row in DBGrid and with moving scrollbar selected row changes it's normal? it should only scroll page to up or down and not change selection. Something that happens in C# and other.

Share this post


Link to post
3 hours ago, Behdadsoft said:

Hi.

I have a DBGrid on my form that contain many rows. the problem is that, scrollbar don't work normally like other programming language. I searched in google for find a solution for this issue but I couldn't find anything. for better understanding, I captured a video from C# DataGridView and Delphi DBGrid that the problem is obvious.
Also I Use Delphi 11.1.

 

Video: Compare C# and Delphi Scrollbar

A TDBGrid is a kind of virtual grid. It shows rows from a dataset and does not know how many rows the dataset contains (the dataset itself may not know that, in fact). So it scrolls the active row in the dataset, not the rows in the grid; the selected row in the grid corresponds to the active record in the dataset. The grid actually contains only enough rows to fill the visible area, which get reused for new content as the dataset is scrolled.

Share this post


Link to post

See:

.
I didn't try it, but perhaps the solution by aehimself will work for you?

I used the few lines of code from Uwe Raabe for smooth scrolling.

 

  • Like 1

Share this post


Link to post

I don't know if it will be interesting for you. To avoid similar and different problems with DBGrid, I switched to TVirtualStringTree very quickly. About a week. And I was a beginner. I have no problems with TVirtualStringTree.
For the same reasons, I left the DB components. Then I bought TMS components and after a while I went back to DB components. But TMS.

Share this post


Link to post
4 hours ago, Behdadsoft said:

If you select a row in DBGrid and with moving scrollbar selected row changes it's normal? it should only scroll page to up or down and not change selection. Something that happens in C# and other.

Well, Delphi was first not C#. With "the other" I can't deal.

Anyway, I'd suggest you to hire a Delphi coder who can easily override the corresponding event handlers to let TDBGrid behave like you describe. (For whatever mystic reason)

 

Share this post


Link to post

I found a solution for this issue. NextDBGrid6 Component form bergsoft is working like C# DataGridView.

Edited by Behdadsoft

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×