Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DBGRID Scrollbars

128 views
Skip to first unread message

Craig

unread,
Aug 1, 2003, 4:13:33 PM8/1/03
to
How do I get rid of the scrollbars on a dbgrid.

TIA
Craig

this with a dot_telkamp@12move.nl maurice

unread,
Aug 5, 2003, 5:26:17 AM8/5/03
to

"Craig" <ckunze...@ci.riverside.ca.us> schreef in bericht
news:3f2ac9ed$1...@newsgroups.borland.com...

> How do I get rid of the scrollbars on a dbgrid.
>
> TIA
> Craig
>

try:
ShowScrollBar(MyDBGrid.handle, SB_VERT, false); and/or
ShowScrollBar(MyDBGrid.handle, SB_HORZ, false);
(You need to do this whenever the underlying dataset gets active)

Hope this helps,
Maurice

dennis_passmore

unread,
Aug 5, 2003, 1:03:36 PM8/5/03
to
The only way to really make the Scrollbars not appear without getting a terrible
flickering when the screen redraws is to modify the DbGrids.pas unit and make the
Procedure UpdateScrollBar; protected and virtual so it can be overridden later.

Next create a descendant class of TDbGrid as I have done with the following "interposer"
class and override UpdateScrollBar procedure and do nothing, then in the constructor
just turn off the Scrollbars (ssNone).

Modification for DbGrids.pas
------------------------------
procedure UpdateActive;
procedure UpdateIme;
// procedure UpdateScrollBar;
procedure UpdateRowCount;
procedure WriteColumns(Writer: TWriter);
....
....
....
protected
FUpdateFields: Boolean;
FAcquireFocus: Boolean;
procedure UpdateScrollBar; virtual; // added
function RawToDataColumn(ACol: Integer): Integer;


Example "Interposer" class:
--------------------------------
unit customdbgridu;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
StdCtrls, Dialogs, Grids, DBGrids, DB, DBTables;
type
TDbGrid = class(DBGrids.TDbGrid)
protected
procedure UpdateScrollBar; override;
public
constructor Create(AOwner: TComponent); override;
end;
TForm1 = class(TForm)
DataSource1: TDataSource;
Table1: TTable;
Database1: TDatabase;
DBGrid1: TDBGrid;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}


procedure TDbGrid.UpdateScrollBar;
begin
// do nothing so they will not get turned back on
end;

constructor TDbGrid.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Scrollbars := ssNone; // optional
end;

end.


Dennis Passmore
Ultimate Software, Inc.

0 new messages