I have to add some menu entries with localisation. I added
Code: Select all
// TrvActionInsertDatel
'&Datum', 'Datum einfügen|Fügt das aktuelle Datumin das Dokument ein',
THX
Code: Select all
// TrvActionInsertDatel
'&Datum', 'Datum einfügen|Fügt das aktuelle Datumin das Dokument ein',
Code: Select all
procedure TrvCustomAction.Localize;
begin
if FMessageID<>rvam_Empty then begin
Caption := RVA_GetS(FMessageID);
Hint := RVA_GetS(succ(FMessageID));
end;
end;
Code: Select all
rvActionInsertCDate: TmyActionInsertCDate;
Code: Select all
unit myActions;
interface
{$I RV_Defs.inc}
uses
Windows, Messages, Classes, Graphics, SysUtils, Controls, StdCtrls,
Printers, Dialogs, Forms, ShellApi, Clipbrd,
{$IFDEF RICHVIEWDEF6}
DateUtils,
{$ENDIF}
RichView, rvrvData, rvEdit, ActnList, RVTable,
RVItem, RVStyle, RVTInplace, rvScroll, rvUni, PtblRV, RVERVData, RVMisc,
{$IFDEF USERVXML}
RichViewXML,
{$ENDIF}
{$IFDEF USERVHTML}
RVHTMLImport, RVNormalize,
{$ENDIF}
{$IFDEF USERVADDICT3}
ad3RichViewCmpnts, ad3SpellBase,
{$ENDIF}
{$IFDEF USERVKSDEVTE}
te_controls,
{$ENDIF}
{$IFDEF USEINDY}
idhttp,
{$ENDIF}
{$IFDEF USEJVCL}
JvWinDialogs,
{$ENDIF}
{$IFDEF USETB2K}
TB2Item,
{$ENDIF}
{$IFDEF USETBX}
TBX,
{$ENDIF}
CRVData, RVClasses,RVOfficeCnv, ExtDlgs, RVFuncs, Menus,
RVALocalize, RichViewActions;
type
TmyAction = class(TrvAction);
TmyActionInsertCDate = class(TmyAction)
private
FOnInsertCDate: TRVAInsertTextEvent;
public
procedure ExecuteTarget(Target: TObject); override;
procedure UpdateTarget(Target: TObject); override;
published
property OnInsertCDate: TRVAInsertTextEvent read FOnInsertCDate write FOnInsertCDate;
end;
implementation
procedure TmyActionInsertCDate.ExecuteTarget(Target: TObject);
var rve: TCustomRichViewEdit;
s: String;
begin
if Assigned(FOnInsertCDate) then begin
rve := GetControl(Target);
s := FormatDateTime('d. mmmm yyyy', Now);
// FOnInsertText(Self, rve, s); ###comple error
rve.InsertText(s);
end else
Beep;
end;
procedure TmyActionInsertCDate.UpdateTarget(Target: TObject);
var rve: TCustomRichViewEdit;
begin
if not RVA_ActionsEnabled or Disabled then begin
Enabled := False;
exit;
end;
rve := GetControl(Target).TopLevelEditor;
Enabled := rve.RVData.PartialSelectedItem=nil;
end;
end.