[Lazarus] TDBNavigator Buttons

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] TDBNavigator Buttons

Free Pascal - Lazarus mailing list
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;


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus