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