Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-06

TDBNavigator Buttons

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

kapibara

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;

Reply by email