[Lazarus] TDBNavigator Buttons
kapibara
kapibara.pas at aol.com
Mon Jun 5 19:03:19 CEST 2017
I wanted to disable the Insert button of the TDBNavigator so it couldn't
be pressed again until the current record is saved. So I added a
property "Buttons" to TDBCustomNavigator.
Could there be sideeffects? Or maybe there is a simpler way of
preventing inserting or refreshing on unsaved record than disabling buttons?
Here's the changed code in dbcustomnavigator.inc:
TDBCustomNavigator = class(CustomPanel)
private
function GetButton(Index: TDBNavButtonType): TDBNavButton;
procedure SetButton(Index: TDBNavButtonType; AValue: TDBNavButton);
protected
FButtons: array[TDBNavButtonType] of TDBNavButton;
public
property Buttons[Index: TDBNavButtonType]: TDBNavButton read
GetButton write SetButton;
implementation
function TDBCustomNavigator.GetButton(Index: TDBNavButtonType):
TDBNavButton;
begin
Result:=FButtons[Index];
end;
procedure TDBCustomNavigator.SetButton(Index: TDBNavButtonType;
AValue: TDBNavButton);
begin
FButtons[Index]:=AValue;
end;
More information about the Lazarus
mailing list