mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 11:40:13 +02:00
LCL: Implement DBAction on DBControls. Issue #25988, patch from Luigi
git-svn-id: trunk@46203 -
This commit is contained in:
parent
ee833d9792
commit
2d68a26e97
@ -194,6 +194,8 @@ Type
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
function ExecuteAction(AAction: TBasicAction): Boolean; override;
|
||||
function UpdateAction(AAction: TBasicAction): Boolean; override;
|
||||
property Field: TField read GetField;
|
||||
published
|
||||
property CustomEditMask: Boolean read FCustomEditMask write FCustomEditMask default False;
|
||||
@ -267,6 +269,8 @@ Type
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
function ExecuteAction(AAction: TBasicAction): Boolean; override;
|
||||
function UpdateAction(AAction: TBasicAction): Boolean; override;
|
||||
property Field: TField read GetField;
|
||||
published
|
||||
property Align;
|
||||
@ -339,6 +343,8 @@ Type
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
function ExecuteAction(AAction: TBasicAction): Boolean; override;
|
||||
function UpdateAction(AAction: TBasicAction): Boolean; override;
|
||||
property Field: TField read GetField;
|
||||
property DataField: string read GetDataField write SetDataField;
|
||||
property DataSource: TDataSource read GetDataSource write SetDataSource;
|
||||
@ -517,6 +523,8 @@ Type
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure EditingDone; override;
|
||||
function ExecuteAction(AAction: TBasicAction): Boolean; override;
|
||||
function UpdateAction(AAction: TBasicAction): Boolean; override;
|
||||
property Field: TField read GetField;
|
||||
property ItemIndex;
|
||||
property Value: string read FValue write SetValue;
|
||||
@ -579,6 +587,8 @@ Type
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
function ExecuteAction(AAction: TBasicAction): Boolean; override;
|
||||
function UpdateAction(AAction: TBasicAction): Boolean; override;
|
||||
property Checked;
|
||||
property Field: TField read GetField;
|
||||
property State;
|
||||
@ -647,6 +657,8 @@ Type
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
function ExecuteAction(AAction: TBasicAction): Boolean; override;
|
||||
function UpdateAction(AAction: TBasicAction): Boolean; override;
|
||||
procedure EditingDone; override;
|
||||
property Field: TField read GetField;
|
||||
property Text;
|
||||
@ -851,6 +863,8 @@ Type
|
||||
destructor Destroy; override;
|
||||
procedure EditingDone; override;
|
||||
procedure LoadMemo; virtual;
|
||||
function ExecuteAction(AAction: TBasicAction): Boolean; override;
|
||||
function UpdateAction(AAction: TBasicAction): Boolean; override;
|
||||
property Field: TField read GetField;
|
||||
published
|
||||
property Align;
|
||||
@ -916,6 +930,8 @@ Type
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
function ExecuteAction(AAction: TBasicAction): Boolean; override;
|
||||
function UpdateAction(AAction: TBasicAction): Boolean; override;
|
||||
property Field: TField read GetField;
|
||||
published
|
||||
property Align;
|
||||
@ -995,6 +1011,8 @@ Type
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
function ExecuteAction(AAction: TBasicAction): Boolean; override;
|
||||
function UpdateAction(AAction: TBasicAction): Boolean; override;
|
||||
property Field: TField read GetField;
|
||||
procedure Change; virtual;
|
||||
published
|
||||
@ -1057,6 +1075,8 @@ Type
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure EditingDone; override;
|
||||
function ExecuteAction(AAction: TBasicAction): Boolean; override;
|
||||
function UpdateAction(AAction: TBasicAction): Boolean; override;
|
||||
|
||||
property Field: TField read GetField;
|
||||
published
|
||||
|
@ -488,6 +488,8 @@ type
|
||||
procedure ResetColWidths;
|
||||
destructor Destroy; override;
|
||||
function MouseToRecordOffset(const x,y: Integer; out Column: TColumn; out RecordOffset: Integer): TGridZone;
|
||||
function ExecuteAction(AAction: TBasicAction): Boolean; override;
|
||||
function UpdateAction(AAction: TBasicAction): Boolean; override;
|
||||
property AllowOutboundEvents;
|
||||
property SelectedField: TField read GetCurrentField write SetCurrentField;
|
||||
property SelectedIndex: Integer read GetSelectedIndex write SetSelectedIndex;
|
||||
@ -1428,7 +1430,7 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
procedure TCustomDBGrid.PrepareCellHints(ACol, ARow: Integer);
|
||||
procedure TCustomDBGrid.PrepareCellHints(aCol, aRow: Integer);
|
||||
begin
|
||||
if not DataLink.Active then Exit;
|
||||
FSavedRecord := DataLink.ActiveRecord;
|
||||
@ -1441,7 +1443,7 @@ begin
|
||||
DataLink.ActiveRecord := FSavedRecord;
|
||||
end;
|
||||
|
||||
function TCustomDBGrid.GetCellHintText(ACol, ARow: Integer): String;
|
||||
function TCustomDBGrid.GetCellHintText(aCol, aRow: Integer): String;
|
||||
var
|
||||
C: TColumn;
|
||||
begin
|
||||
@ -1455,7 +1457,7 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
function TCustomDBGrid.GetTruncCellHintText(ACol, ARow: integer): String;
|
||||
function TCustomDBGrid.GetTruncCellHintText(aCol, aRow: Integer): string;
|
||||
var
|
||||
F: TField;
|
||||
begin
|
||||
@ -1609,7 +1611,7 @@ begin
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TCustomDBGrid.doLayoutChanged;
|
||||
procedure TCustomDBGrid.DoLayoutChanged;
|
||||
begin
|
||||
if csDestroying in ComponentState then
|
||||
exit;
|
||||
@ -1638,7 +1640,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCustomDBGrid.IsEOF: boolean;
|
||||
function TCustomDBGrid.ISEOF: boolean;
|
||||
begin
|
||||
{$ifdef dbgDBGrid}
|
||||
DebugLn('%s.IsEOF', [ClassName]);
|
||||
@ -2620,7 +2622,7 @@ begin
|
||||
inc(FLayoutChangedCount);
|
||||
end;
|
||||
|
||||
procedure TCustomDBGrid.EditingColumn(aCol: Integer; Ok: Boolean);
|
||||
procedure TCustomDBGrid.EditingColumn(aCol: Integer; Ok: boolean);
|
||||
begin
|
||||
{$ifdef dbgDBGrid}DebugLnEnter('%s.EditingColumn INIT aCol=%d Ok=%s',
|
||||
[ClassName, aCol, BoolToStr(ok, true)]); {$endif}
|
||||
@ -3481,6 +3483,18 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCustomDBGrid.ExecuteAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := (DataLink <> nil)
|
||||
and DataLink.ExecuteAction(AAction);
|
||||
end;
|
||||
|
||||
function TCustomDBGrid.UpdateAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := (DataLink <> nil)
|
||||
and DataLink.UpdateAction(AAction);
|
||||
end;
|
||||
|
||||
{ TComponentDataLink }
|
||||
|
||||
function TComponentDataLink.GetFields(Index: Integer): TField;
|
||||
|
@ -119,3 +119,15 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TCustomDBComboBox.ExecuteAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited ExecuteAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.ExecuteAction(AAction);
|
||||
end;
|
||||
|
||||
function TCustomDBComboBox.UpdateAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited UpdateAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.UpdateAction(AAction);
|
||||
end;
|
||||
|
||||
|
@ -119,3 +119,15 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TCustomDBListBox.ExecuteAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited ExecuteAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.ExecuteAction(AAction);
|
||||
end;
|
||||
|
||||
function TCustomDBListBox.UpdateAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited UpdateAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.UpdateAction(AAction);
|
||||
end;
|
||||
|
||||
|
@ -102,6 +102,18 @@ begin
|
||||
inherited EditingDone;
|
||||
end;
|
||||
|
||||
function TDBCalendar.ExecuteAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited ExecuteAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.ExecuteAction(AAction);
|
||||
end;
|
||||
|
||||
function TDBCalendar.UpdateAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited UpdateAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.UpdateAction(AAction);
|
||||
end;
|
||||
|
||||
{ Public Methods }
|
||||
constructor TDBCalendar.Create(TheOwner: TComponent);
|
||||
begin
|
||||
|
@ -195,4 +195,16 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TDBCheckBox.ExecuteAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited ExecuteAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.ExecuteAction(AAction);
|
||||
end;
|
||||
|
||||
function TDBCheckBox.UpdateAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited UpdateAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.UpdateAction(AAction);
|
||||
end;
|
||||
|
||||
// included by dbctrls.pas
|
||||
|
@ -259,3 +259,15 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TDBEdit.ExecuteAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited ExecuteAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.ExecuteAction(AAction);
|
||||
end;
|
||||
|
||||
function TDBEdit.UpdateAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited UpdateAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.UpdateAction(AAction);
|
||||
end;
|
||||
|
||||
|
@ -71,4 +71,16 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TDBGroupBox.ExecuteAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited ExecuteAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.ExecuteAction(AAction);
|
||||
end;
|
||||
|
||||
function TDBGroupBox.UpdateAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited UpdateAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.UpdateAction(AAction);
|
||||
end;
|
||||
|
||||
// included by dbctrls.pas
|
||||
|
@ -272,4 +272,16 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TDBImage.ExecuteAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited ExecuteAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.ExecuteAction(AAction);
|
||||
end;
|
||||
|
||||
function TDBImage.UpdateAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited UpdateAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.UpdateAction(AAction);
|
||||
end;
|
||||
|
||||
// included by dbctrls.pas
|
||||
|
@ -243,4 +243,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TDBMemo.ExecuteAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited ExecuteAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.ExecuteAction(AAction);
|
||||
end;
|
||||
|
||||
function TDBMemo.UpdateAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited UpdateAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.UpdateAction(AAction);
|
||||
end;
|
||||
|
||||
// included by dbctrls.pas
|
||||
|
@ -145,6 +145,18 @@ begin
|
||||
inherited EditingDone;
|
||||
end;
|
||||
|
||||
function TDBRadioGroup.ExecuteAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited ExecuteAction(AAction) or
|
||||
(DataLink <> nil) and DataLink.ExecuteAction(AAction);
|
||||
end;
|
||||
|
||||
function TDBRadioGroup.UpdateAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited UpdateAction(AAction) or
|
||||
(DataLink <> nil) and DataLink.UpdateAction(AAction);
|
||||
end;
|
||||
|
||||
constructor TDBRadioGroup.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
|
@ -104,3 +104,15 @@ begin
|
||||
FDataLink.Destroy;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TDBText.ExecuteAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited ExecuteAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.ExecuteAction(AAction);
|
||||
end;
|
||||
|
||||
function TDBText.UpdateAction(AAction: TBasicAction): Boolean;
|
||||
begin
|
||||
Result := inherited UpdateAction(AAction) or
|
||||
(FDataLink <> nil) and FDataLink.UpdateAction(AAction);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user