TDBNavigator delete record confirmation
Original Reporter info from Mantis: ssy
-
Reporter name: Sergey Smirnov
Original Reporter info from Mantis: ssy
- Reporter name: Sergey Smirnov
Description:
TDBNavigator with property ConfirmDelete = True always display message 'Delete record?'. I need another message in another language, so I want to offer to add special property for it. Patches for DbCtrls.pp and dbcustomnavigator.inc (from 0.9.24 win32 release) are in Additional Information.
Additional information:
In module DbCtrls.pp:
*************** *** 836,841 **** --- 836,842 ---- TDBCustomNavigator = class(TCustomPanel) private FBeforeAction: TDBNavClickEvent; + FConfDelMessage: string; FConfirmDelete: Boolean; FDataLink: TDBNavDataLink; FDirection: TDBNavButtonDirection; *************** *** 851,856 **** --- 852,858 ---- procedure DefaultHintsChanged(Sender: TObject); function GetDataSource: TDataSource; function GetHints: TStrings; + procedure SetConfDelMessage(const AValue: string); procedure SetDataSource(const AValue: TDataSource); procedure SetDirection(const AValue: TDBNavButtonDirection); procedure SetFlat(const AValue: Boolean); *************** *** 881,886 **** --- 883,889 ---- public property BeforeAction: TDBNavClickEvent read FBeforeAction write FBeforeAction; property ConfirmDelete: Boolean read FConfirmDelete write FConfirmDelete default True; + property ConfDelMessage: string read FConfDelMessage write SetConfDelMessage; property DataSource: TDataSource read GetDataSource write SetDataSource; property Direction: TDBNavButtonDirection read FDirection write SetDirection default nbdHorizontal; property Flat: Boolean read FFlat write SetFlat default False; *************** *** 941,946 **** --- 944,950 ---- property ClientWidth; property Color default clBackground; property ConfirmDelete; + property ConfDelMessage; property DataSource; property Direction; property DragCursor;
In include dbcustomnavigator.inc:
*************
* 373,378 ****
--- 373,379 ----BevelOuter:=bvNone; BevelInner:=bvNone; FConfirmDelete:=True;
+ FConfDelMessage:='Delete record?';
SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y); UpdateButtons; EndUpdateButtons;
*************
* 407,414 ****nbPost: Post; nbRefresh: Refresh; nbDelete:
! if (not ConfirmDelete)
! or (MessageDlg('Delete record?',mtConfirmation,mbOKCancel,0)<>mrCancel)then Delete; end;
--- 408,415 ----
nbPost: Post; nbRefresh: Refresh; nbDelete:
! if (not FConfirmDelete)
! or (MessageDlg(FConfDelMessage,mtConfirmation,mbOKCancel,0)<>mrCancel)then Delete; end;
*************
* 428,431 ****
--- 429,438 ----inc(Result); end;
+ procedure TDBCustomNavigator.SetConfDelMessage(const AValue: string);
+ begin
+ if FConfDelMessage=AValue then exit;
+ FConfDelMessage:=AValue;end; // included by dbctrls.pas
Mantis conversion info: