View Issue Details

IDProjectCategoryView StatusLast Update
0010372LazarusLCLpublic2013-09-03 12:07
ReporterSergey SmirnovAssigned ToMaxim Ganetsky 
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.24Product Build 
Target VersionFixed in Version0.9.29 (SVN) 
Summary0010372: TDBNavigator delete record confirmation
DescriptionTDBNavigator 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 InformationIn 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
TagsNo tags attached.
Fixed in Revision13274, 25318
LazTarget1.4
WidgetsetWin32/Win64
Attached Files

Activities

Vincent Snijders

2007-12-07 23:44

manager   ~0016615

Just a translation or a more elaborate message?

Sergey Smirnov

2007-12-08 09:15

reporter   ~0016617

Mostly translation, but more elaborate message too. Now I think the resource string (*.po with standard translation mechanism) will be more useful for default value. And this is true for Hints property too. How can I do this?

Vincent Snijders

2007-12-08 11:36

manager   ~0016619

I think for a more elaborate message, an event would be more appropriate.

You can use tools -> make resourcestring to create a resource string from the selected text.

Vincent Snijders

2007-12-11 12:18

manager   ~0016666

I added a resourcestring for 'Delete record?' in r13274.

Maxim Ganetsky

2010-05-11 23:00

developer   ~0037460

Last edited: 2010-05-12 00:56

Resourcestring for 'Delete record?' was already added.
If another wording of this message is needed, you can set ConfirmDelete property to false and use BeforeAction event for confirming and aborting delete action.
Hints are automatically localized since r25318.

Issue History

Date Modified Username Field Change
2007-12-07 18:54 Sergey Smirnov New Issue
2007-12-07 18:54 Sergey Smirnov Widgetset => Win32
2007-12-07 23:44 Vincent Snijders LazTarget => 0.9.26
2007-12-07 23:44 Vincent Snijders Note Added: 0016615
2007-12-07 23:44 Vincent Snijders Status new => acknowledged
2007-12-08 09:15 Sergey Smirnov Note Added: 0016617
2007-12-08 11:36 Vincent Snijders Note Added: 0016619
2007-12-11 12:18 Vincent Snijders Note Added: 0016666
2007-12-12 11:45 Vincent Snijders LazTarget 0.9.26 => post 1.2
2010-05-11 09:21 Paul Ishenin Status acknowledged => assigned
2010-05-11 09:21 Paul Ishenin Assigned To => Maxim Ganetsky
2010-05-11 23:00 Maxim Ganetsky Status assigned => resolved
2010-05-11 23:00 Maxim Ganetsky Resolution open => no change required
2010-05-11 23:00 Maxim Ganetsky Note Added: 0037460
2010-05-12 00:56 Maxim Ganetsky Note Edited: 0037460
2010-05-12 00:58 Maxim Ganetsky Fixed in Revision => 13274, 25318
2010-05-12 00:58 Maxim Ganetsky Resolution no change required => fixed
2010-05-12 00:58 Maxim Ganetsky Fixed in Version => 0.9.29 (SVN)
2011-12-01 11:23 Marc Weustink Status resolved => closed
2013-09-03 12:07 Martin Friebe LazTarget post 1.2 => 1.4