RxDBGrid - AllowedOperations is depricated

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2812 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2013-10-28 20:06:02 +00:00
parent 84c1091074
commit 874dbce42c
2 changed files with 90 additions and 22 deletions

View File

@@ -469,7 +469,7 @@ type
FSortColumns: TRxDbGridColumnsSortList; FSortColumns: TRxDbGridColumnsSortList;
FSortingNow:Boolean; FSortingNow:Boolean;
FInProcessCalc: integer; FInProcessCalc: integer;
FAllowedOperations: TRxDBGridAllowedOperations; // FAllowedOperations: TRxDBGridAllowedOperations;
// //
FKeyStrokes: TRxDBGridKeyStrokes; FKeyStrokes: TRxDBGridKeyStrokes;
FOnGetCellProps: TGetCellPropsEvent; FOnGetCellProps: TGetCellPropsEvent;
@@ -523,6 +523,7 @@ type
FOldDataSetState:TDataSetState; FOldDataSetState:TDataSetState;
procedure DoCreateJMenu; procedure DoCreateJMenu;
function GetAllowedOperations: TRxDBGridAllowedOperations;
function GetColumns: TRxDbGridColumns; function GetColumns: TRxDbGridColumns;
function GetFooterColor: TColor; function GetFooterColor: TColor;
function GetFooterRowCount: integer; function GetFooterRowCount: integer;
@@ -533,6 +534,7 @@ type
function GetSortOrder: TSortMarker; function GetSortOrder: TSortMarker;
function GetTitleButtons: boolean; function GetTitleButtons: boolean;
function IsColumnsStored: boolean; function IsColumnsStored: boolean;
procedure SetAllowedOperations(AValue: TRxDBGridAllowedOperations);
procedure SetAutoSort(const AValue: boolean); procedure SetAutoSort(const AValue: boolean);
procedure SetColumns(const AValue: TRxDbGridColumns); procedure SetColumns(const AValue: TRxDbGridColumns);
procedure SetFooterColor(const AValue: TColor); procedure SetFooterColor(const AValue: TColor);
@@ -712,8 +714,7 @@ type
read GetPropertyStorage write SetPropertyStorage; read GetPropertyStorage write SetPropertyStorage;
property Version: integer read FVersion write FVersion default 0; property Version: integer read FVersion write FVersion default 0;
property AllowedOperations: TRxDBGridAllowedOperations property AllowedOperations: TRxDBGridAllowedOperations
read FAllowedOperations write FAllowedOperations default read GetAllowedOperations write SetAllowedOperations default [aoInsert, aoUpdate, aoDelete, aoAppend]; deprecated;
[aoInsert, aoUpdate, aoDelete, aoAppend];
property OptionsRx: TOptionsRx read FOptionsRx write SetOptionsRx; property OptionsRx: TOptionsRx read FOptionsRx write SetOptionsRx;
property FooterColor: TColor read GetFooterColor write SetFooterColor default clWindow; deprecated; property FooterColor: TColor read GetFooterColor write SetFooterColor default clWindow; deprecated;
property FooterRowCount: integer read GetFooterRowCount write SetFooterRowCount default 0; deprecated; property FooterRowCount: integer read GetFooterRowCount write SetFooterRowCount default 0; deprecated;
@@ -1696,6 +1697,22 @@ begin
CreateMenuItem('A', sRxDBGridSelectAllRows, @OnSelectAllRows); CreateMenuItem('A', sRxDBGridSelectAllRows, @OnSelectAllRows);
end; end;
function TRxDBGrid.GetAllowedOperations: TRxDBGridAllowedOperations;
begin
// Result:=FAllowedOperations;
if dgDisableInsert in Options then
Result:=Result - [aoInsert, aoAppend]
else
Result:=Result + [aoInsert, aoAppend]
;
if dgDisableDelete in Options then
Result:=Result - [aoDelete]
else
Result:=Result + [aoDelete]
;
end;
function TRxDBGrid.GetPropertyStorage: TCustomPropertyStorage; function TRxDBGrid.GetPropertyStorage: TCustomPropertyStorage;
begin begin
Result := FPropertyStorageLink.Storage; Result := FPropertyStorageLink.Storage;
@@ -1727,6 +1744,20 @@ begin
Result := TRxDbGridColumns(TCustomDrawGrid(Self).Columns).Enabled; Result := TRxDbGridColumns(TCustomDrawGrid(Self).Columns).Enabled;
end; end;
procedure TRxDBGrid.SetAllowedOperations(AValue: TRxDBGridAllowedOperations);
begin
// FAllowedOperations:=AValue;
if [aoInsert, aoAppend] * AValue <> [aoInsert, aoAppend] then
Options:=Options - [dgDisableInsert]
else
Options:=Options + [dgDisableInsert];
if aoDelete in AValue then
Options:=Options - [dgDisableDelete]
else
Options:=Options + [dgDisableDelete]
end;
procedure TRxDBGrid.SetColumns(const AValue: TRxDbGridColumns); procedure TRxDBGrid.SetColumns(const AValue: TRxDbGridColumns);
begin begin
TRxDbGridColumns(TCustomDrawGrid(Self).Columns).Assign(Avalue); TRxDbGridColumns(TCustomDrawGrid(Self).Columns).Assign(Avalue);
@@ -3467,8 +3498,8 @@ begin
if (Key in CCancelQuickSearchKeys) then if (Key in CCancelQuickSearchKeys) then
if Length(QuickUTF8Search) > 0 then if Length(QuickUTF8Search) > 0 then
QuickUTF8Search := ''; QuickUTF8Search := '';
case Key of (* case Key of
VK_DELETE: if not (aoDelete in FAllowedOperations) then { VK_DELETE: if not (aoDelete in FAllowedOperations) then
exit; exit;
VK_INSERT: if not (aoInsert in FAllowedOperations) then VK_INSERT: if not (aoInsert in FAllowedOperations) then
exit; exit;
@@ -3495,14 +3526,17 @@ begin
begin begin
FTmpReadOnly := ReadOnly; FTmpReadOnly := ReadOnly;
ReadOnly := True; ReadOnly := True;
try
inherited KeyDown(Key, Shift); inherited KeyDown(Key, Shift);
finally
ReadOnly := FTmpReadOnly; ReadOnly := FTmpReadOnly;
end;
exit; exit;
end end }
{ else { else
UpdateRowsHeight; UpdateRowsHeight;
VK_UP:UpdateRowsHeight}; VK_UP:UpdateRowsHeight}
end; end; *)
inherited KeyDown(Key, Shift); inherited KeyDown(Key, Shift);
if Key <> 0 then if Key <> 0 then
begin begin
@@ -4438,7 +4472,7 @@ begin
FPropertyStorageLink.OnSave := @OnIniSave; FPropertyStorageLink.OnSave := @OnIniSave;
FPropertyStorageLink.OnLoad := @OnIniLoad; FPropertyStorageLink.OnLoad := @OnIniLoad;
FAllowedOperations := [aoInsert, aoUpdate, aoDelete, aoAppend]; // FAllowedOperations := [aoInsert, aoUpdate, aoDelete, aoAppend];
FFilterListEditor := TFilterListCellEditor.Create(nil); FFilterListEditor := TFilterListCellEditor.Create(nil);
with FFilterListEditor do with FFilterListEditor do

View File

@@ -469,7 +469,7 @@ type
FSortColumns: TRxDbGridColumnsSortList; FSortColumns: TRxDbGridColumnsSortList;
FSortingNow:Boolean; FSortingNow:Boolean;
FInProcessCalc: integer; FInProcessCalc: integer;
FAllowedOperations: TRxDBGridAllowedOperations; // FAllowedOperations: TRxDBGridAllowedOperations;
// //
FKeyStrokes: TRxDBGridKeyStrokes; FKeyStrokes: TRxDBGridKeyStrokes;
FOnGetCellProps: TGetCellPropsEvent; FOnGetCellProps: TGetCellPropsEvent;
@@ -523,6 +523,7 @@ type
FOldDataSetState:TDataSetState; FOldDataSetState:TDataSetState;
procedure DoCreateJMenu; procedure DoCreateJMenu;
function GetAllowedOperations: TRxDBGridAllowedOperations;
function GetColumns: TRxDbGridColumns; function GetColumns: TRxDbGridColumns;
function GetFooterColor: TColor; function GetFooterColor: TColor;
function GetFooterRowCount: integer; function GetFooterRowCount: integer;
@@ -533,6 +534,7 @@ type
function GetSortOrder: TSortMarker; function GetSortOrder: TSortMarker;
function GetTitleButtons: boolean; function GetTitleButtons: boolean;
function IsColumnsStored: boolean; function IsColumnsStored: boolean;
procedure SetAllowedOperations(AValue: TRxDBGridAllowedOperations);
procedure SetAutoSort(const AValue: boolean); procedure SetAutoSort(const AValue: boolean);
procedure SetColumns(const AValue: TRxDbGridColumns); procedure SetColumns(const AValue: TRxDbGridColumns);
procedure SetFooterColor(const AValue: TColor); procedure SetFooterColor(const AValue: TColor);
@@ -712,8 +714,7 @@ type
read GetPropertyStorage write SetPropertyStorage; read GetPropertyStorage write SetPropertyStorage;
property Version: integer read FVersion write FVersion default 0; property Version: integer read FVersion write FVersion default 0;
property AllowedOperations: TRxDBGridAllowedOperations property AllowedOperations: TRxDBGridAllowedOperations
read FAllowedOperations write FAllowedOperations default read GetAllowedOperations write SetAllowedOperations default [aoInsert, aoUpdate, aoDelete, aoAppend]; deprecated;
[aoInsert, aoUpdate, aoDelete, aoAppend];
property OptionsRx: TOptionsRx read FOptionsRx write SetOptionsRx; property OptionsRx: TOptionsRx read FOptionsRx write SetOptionsRx;
property FooterColor: TColor read GetFooterColor write SetFooterColor default clWindow; deprecated; property FooterColor: TColor read GetFooterColor write SetFooterColor default clWindow; deprecated;
property FooterRowCount: integer read GetFooterRowCount write SetFooterRowCount default 0; deprecated; property FooterRowCount: integer read GetFooterRowCount write SetFooterRowCount default 0; deprecated;
@@ -1696,6 +1697,22 @@ begin
CreateMenuItem('A', sRxDBGridSelectAllRows, @OnSelectAllRows); CreateMenuItem('A', sRxDBGridSelectAllRows, @OnSelectAllRows);
end; end;
function TRxDBGrid.GetAllowedOperations: TRxDBGridAllowedOperations;
begin
// Result:=FAllowedOperations;
if dgDisableInsert in Options then
Result:=Result - [aoInsert, aoAppend]
else
Result:=Result + [aoInsert, aoAppend]
;
if dgDisableDelete in Options then
Result:=Result - [aoDelete]
else
Result:=Result + [aoDelete]
;
end;
function TRxDBGrid.GetPropertyStorage: TCustomPropertyStorage; function TRxDBGrid.GetPropertyStorage: TCustomPropertyStorage;
begin begin
Result := FPropertyStorageLink.Storage; Result := FPropertyStorageLink.Storage;
@@ -1727,6 +1744,20 @@ begin
Result := TRxDbGridColumns(TCustomDrawGrid(Self).Columns).Enabled; Result := TRxDbGridColumns(TCustomDrawGrid(Self).Columns).Enabled;
end; end;
procedure TRxDBGrid.SetAllowedOperations(AValue: TRxDBGridAllowedOperations);
begin
// FAllowedOperations:=AValue;
if [aoInsert, aoAppend] * AValue <> [aoInsert, aoAppend] then
Options:=Options - [dgDisableInsert]
else
Options:=Options + [dgDisableInsert];
if aoDelete in AValue then
Options:=Options - [dgDisableDelete]
else
Options:=Options + [dgDisableDelete]
end;
procedure TRxDBGrid.SetColumns(const AValue: TRxDbGridColumns); procedure TRxDBGrid.SetColumns(const AValue: TRxDbGridColumns);
begin begin
TRxDbGridColumns(TCustomDrawGrid(Self).Columns).Assign(Avalue); TRxDbGridColumns(TCustomDrawGrid(Self).Columns).Assign(Avalue);
@@ -3467,8 +3498,8 @@ begin
if (Key in CCancelQuickSearchKeys) then if (Key in CCancelQuickSearchKeys) then
if Length(QuickUTF8Search) > 0 then if Length(QuickUTF8Search) > 0 then
QuickUTF8Search := ''; QuickUTF8Search := '';
case Key of (* case Key of
VK_DELETE: if not (aoDelete in FAllowedOperations) then { VK_DELETE: if not (aoDelete in FAllowedOperations) then
exit; exit;
VK_INSERT: if not (aoInsert in FAllowedOperations) then VK_INSERT: if not (aoInsert in FAllowedOperations) then
exit; exit;
@@ -3495,14 +3526,17 @@ begin
begin begin
FTmpReadOnly := ReadOnly; FTmpReadOnly := ReadOnly;
ReadOnly := True; ReadOnly := True;
try
inherited KeyDown(Key, Shift); inherited KeyDown(Key, Shift);
finally
ReadOnly := FTmpReadOnly; ReadOnly := FTmpReadOnly;
end;
exit; exit;
end end }
{ else { else
UpdateRowsHeight; UpdateRowsHeight;
VK_UP:UpdateRowsHeight}; VK_UP:UpdateRowsHeight}
end; end; *)
inherited KeyDown(Key, Shift); inherited KeyDown(Key, Shift);
if Key <> 0 then if Key <> 0 then
begin begin
@@ -4438,7 +4472,7 @@ begin
FPropertyStorageLink.OnSave := @OnIniSave; FPropertyStorageLink.OnSave := @OnIniSave;
FPropertyStorageLink.OnLoad := @OnIniLoad; FPropertyStorageLink.OnLoad := @OnIniLoad;
FAllowedOperations := [aoInsert, aoUpdate, aoDelete, aoAppend]; // FAllowedOperations := [aoInsert, aoUpdate, aoDelete, aoAppend];
FFilterListEditor := TFilterListCellEditor.Create(nil); FFilterListEditor := TFilterListCellEditor.Create(nil);
with FFilterListEditor do with FFilterListEditor do