Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Thread Tools Display Modes
Old 05-23-2013, 02:44 PM
bulc bulc is offline
Junior Member
Join Date: Apr 2013
Posts: 13
Default How to avoid sliding colums in DBGrid

Hello there.
I have a couple of columns in a DBGrid. When I click into the rightmost one, it slides or skips and I can not see the first one which is a primary key.
How can I avoid this reaction? I've been looking for properties of column fields,
dbgrid, etc without result.
I understand sometimes it is a necessity to change column because there is no space for them; but in this case I want to see them all (all the time).
Any help will be wellcome.
Thank you.
Regards from Ibiza.
Reply With Quote
Old 05-24-2014, 06:48 PM
bulc bulc is offline
Junior Member
Join Date: Apr 2013
Posts: 13
Default Solution

Use event OnColEnter of TDBGrid:

If (Sender is TDBGrid)
If DBGrid1.SelectedIndex = 0 then DBGrid1.SelectedIndex := 1;
Reply With Quote
Old 07-18-2015, 04:16 PM
jdg jdg is offline
Senior Member
Join Date: Sep 2003
Posts: 1,063

If you double click your grid during design time you will open the columns editor where you can set the width of the columns. Or you can wright a routine to save the width of the columns when you close your form, and another to read that when reopen the form, and that way they will return to the same "view" as your last use.

Your problem is that your rightmost column is partially visible and partially off the grid to the right, and when you select it, the grid must bring the full column into view so the grid component scrolls the grid. The solution is to either change the width of some columns or the width of the grid.

Or download a grid that has a fixed column count such as an SMDBGrid from
Reply With Quote
Old 07-27-2015, 06:13 AM
JoevanZYL JoevanZYL is offline
Junior Member
Join Date: Jul 2015
Posts: 1

Scrolling is independent for each split. Often, you need to prevent one or more columns from scrolling so that they will always be in view. True DBGrid provides you with an easy way to keep any number of columns from scrolling at any location within the grid even in the middle by setting a few split properties.

Last edited by JoevanZYL; 11-19-2015 at 10:28 AM.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 12:26 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.