Skip to content

Commit a86d323

Browse files
committed
Added ColMoving property to avoid columns movement
1 parent 452bd3a commit a86d323

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Source/Vcl.LabeledDBCtrls.pas

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ TLabeledDbGrid = class(TDBGrid)
320320
FLinesPerRow: Integer;
321321
FRowMargin: Integer;
322322
FWrapAllText: Boolean;
323+
FColMoving: Boolean;
323324
function TitleOffset: Integer;
324325
procedure OnSearchTimer(Sender : TObject);
325326
procedure SetBoundCaption(const Value: TCaption);
@@ -358,6 +359,7 @@ TLabeledDbGrid = class(TDBGrid)
358359
const AField: TField; Const AColumn: TColumn);
359360
function CalcRowMargin(const ARect: TRect): Integer;
360361
procedure SetWrapAllText(const Value: Boolean);
362+
procedure SetColMoving(const Value: Boolean);
361363
protected
362364
procedure SetParent(AParent: TWinControl); override;
363365
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
@@ -431,6 +433,7 @@ TLabeledDbGrid = class(TDBGrid)
431433
property CanEditColumn: TCBCanEditColumn read FCanEditColumn write FCanEditColumn;
432434
property RowMargin: Integer read FRowMargin write SetRowMargin default 0;
433435
property WrapAllText: Boolean read FWrapAllText write SetWrapAllText default False;
436+
property ColMoving: Boolean read FColMoving write SetColMoving default True;
434437
end;
435438

436439
TNavInsMode = (imInsert, imAppend);
@@ -1203,6 +1206,7 @@ constructor TLabeledDbGrid.Create(AOwner: TComponent);
12031206
FSearchTimer.Interval := INCREMENTAL_DELAY_DEFAULT;
12041207
FSearchTimer.Enabled := False;
12051208
FSearchTimer.OnTimer := OnSearchTimer;
1209+
FColMoving := True;
12061210
end;
12071211

12081212
procedure TLabeledDbGrid.VisibleChanging;
@@ -2370,6 +2374,23 @@ function TLabeledDbGrid.ChangeColumnFieldName(const OldFieldName,
23702374
Column.FieldName := NewFieldName;
23712375
end;
23722376

2377+
2378+
type
2379+
THackCustomGrid = class(TCustomGrid)
2380+
public
2381+
property Options;
2382+
end;
2383+
2384+
procedure TLabeledDbGrid.SetColMoving(const Value: Boolean);
2385+
begin
2386+
FColMoving := Value;
2387+
with THackCustomGrid(Self) do
2388+
if Value then
2389+
Options := Options + [goColMoving]
2390+
else
2391+
Options := Options - [goColMoving];
2392+
end;
2393+
23732394
{ TLabeledDBLabel }
23742395

23752396
constructor TLabeledDBLabel.Create(AOwner: TComponent);

0 commit comments

Comments
 (0)