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

View File

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