tvplanit: Fix print format editor crashing due to translated radiogroup items.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5897 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2017-05-23 19:28:36 +00:00
parent 2a4643b959
commit 8a58f7c8a7
11 changed files with 145 additions and 31 deletions

View File

@ -711,6 +711,10 @@ msgstr "TCanvas wurde nicht zugewiesen."
msgid "Component must be linked to a TVpControlLink" msgid "Component must be linked to a TVpControlLink"
msgstr "Komponente muss mit einem TVpControlLink verbunden sein." msgstr "Komponente muss mit einem TVpControlLink verbunden sein."
#: vpsr.rsnodayincrement
msgid "Day increment unit not specified."
msgstr ""
#: vpsr.rsnolocalizationfile #: vpsr.rsnolocalizationfile
msgid "Localization file not found." msgid "Localization file not found."
msgstr "Sprachdatei nicht gefunden." msgstr "Sprachdatei nicht gefunden."
@ -727,6 +731,10 @@ msgstr "(Nichts)"
msgid "none" msgid "none"
msgstr "keine" msgstr "keine"
#: vpsr.rsnoprintformatname
msgid "Please supply a format name"
msgstr ""
#: vpsr.rsnoprintformats #: vpsr.rsnoprintformats
msgid "No print formats have been defined" msgid "No print formats have been defined"
msgstr "Es sind keine Druckformate definiert." msgstr "Es sind keine Druckformate definiert."
@ -1056,6 +1064,14 @@ msgstr "Samstag"
msgid "Save file..." msgid "Save file..."
msgstr "Datei speichern..." msgstr "Datei speichern..."
#: vpsr.rssaveformatchangestofile
msgid "Save format to file?"
msgstr ""
#: vpsr.rssaveformatchangestofilename
msgid "Save format to \"%s\"?"
msgstr ""
#: vpsr.rsselectasound #: vpsr.rsselectasound
msgid "Select A Sound" msgid "Select A Sound"
msgstr "Einen Klang auswählen" msgstr "Einen Klang auswählen"
@ -1613,3 +1629,4 @@ msgstr "Unbekannte Achsen-Spezifikation: %s"
#: vpsr.sxmldecnotatbeg #: vpsr.sxmldecnotatbeg
msgid "The XML declaration must appear before the first element" msgid "The XML declaration must appear before the first element"
msgstr "Die XML-Deklaration muss vor dem ersten Element erscheinen." msgstr "Die XML-Deklaration muss vor dem ersten Element erscheinen."

View File

@ -701,6 +701,10 @@ msgstr ""
msgid "Component must be linked to a TVpControlLink" msgid "Component must be linked to a TVpControlLink"
msgstr "" msgstr ""
#: vpsr.rsnodayincrement
msgid "Day increment unit not specified."
msgstr ""
#: vpsr.rsnolocalizationfile #: vpsr.rsnolocalizationfile
msgid "Localization file not found." msgid "Localization file not found."
msgstr "" msgstr ""
@ -717,6 +721,10 @@ msgstr ""
msgid "none" msgid "none"
msgstr "" msgstr ""
#: vpsr.rsnoprintformatname
msgid "Please supply a format name"
msgstr ""
#: vpsr.rsnoprintformats #: vpsr.rsnoprintformats
msgid "No print formats have been defined" msgid "No print formats have been defined"
msgstr "" msgstr ""
@ -1046,6 +1054,14 @@ msgstr "Lauantai"
msgid "Save file..." msgid "Save file..."
msgstr "" msgstr ""
#: vpsr.rssaveformatchangestofile
msgid "Save format to file?"
msgstr ""
#: vpsr.rssaveformatchangestofilename
msgid "Save format to \"%s\"?"
msgstr ""
#: vpsr.rsselectasound #: vpsr.rsselectasound
msgid "Select A Sound" msgid "Select A Sound"
msgstr "" msgstr ""
@ -1189,9 +1205,10 @@ msgid "top line"
msgstr "" msgstr ""
#: vpsr.rstrue #: vpsr.rstrue
#, fuzzy
msgctxt "vpsr.rstrue" msgctxt "vpsr.rstrue"
msgid "T" msgid "T"
msgstr "" msgstr "T"
#: vpsr.rstuesday #: vpsr.rstuesday
msgid "Tuesday" msgid "Tuesday"

View File

@ -717,6 +717,10 @@ msgstr "TCanvas non spécifié"
msgid "Component must be linked to a TVpControlLink" msgid "Component must be linked to a TVpControlLink"
msgstr "Le composant doit être lié à un TVpControlLink" msgstr "Le composant doit être lié à un TVpControlLink"
#: vpsr.rsnodayincrement
msgid "Day increment unit not specified."
msgstr ""
#: vpsr.rsnolocalizationfile #: vpsr.rsnolocalizationfile
msgid "Localization file not found." msgid "Localization file not found."
msgstr "Fichier de localization non-trouvé" msgstr "Fichier de localization non-trouvé"
@ -733,6 +737,10 @@ msgstr "(Aucun)"
msgid "none" msgid "none"
msgstr "" msgstr ""
#: vpsr.rsnoprintformatname
msgid "Please supply a format name"
msgstr ""
#: vpsr.rsnoprintformats #: vpsr.rsnoprintformats
msgid "No print formats have been defined" msgid "No print formats have been defined"
msgstr "Formats d'impression non-défini" msgstr "Formats d'impression non-défini"
@ -1062,6 +1070,14 @@ msgstr "Samedi"
msgid "Save file..." msgid "Save file..."
msgstr "" msgstr ""
#: vpsr.rssaveformatchangestofile
msgid "Save format to file?"
msgstr ""
#: vpsr.rssaveformatchangestofilename
msgid "Save format to \"%s\"?"
msgstr ""
#: vpsr.rsselectasound #: vpsr.rsselectasound
msgid "Select A Sound" msgid "Select A Sound"
msgstr "Choissisez un son" msgstr "Choissisez un son"

View File

@ -711,6 +711,10 @@ msgstr "TCanvas is niet toegewezen."
msgid "Component must be linked to a TVpControlLink" msgid "Component must be linked to a TVpControlLink"
msgstr "Component moet moet met een TVpControlLink verbonden zijn" msgstr "Component moet moet met een TVpControlLink verbonden zijn"
#: vpsr.rsnodayincrement
msgid "Day increment unit not specified."
msgstr ""
#: vpsr.rsnolocalizationfile #: vpsr.rsnolocalizationfile
msgid "Localization file not found." msgid "Localization file not found."
msgstr "Vertalingenbestand niet gevonden." msgstr "Vertalingenbestand niet gevonden."
@ -727,6 +731,10 @@ msgstr "(Geen)"
msgid "none" msgid "none"
msgstr "" msgstr ""
#: vpsr.rsnoprintformatname
msgid "Please supply a format name"
msgstr ""
#: vpsr.rsnoprintformats #: vpsr.rsnoprintformats
msgid "No print formats have been defined" msgid "No print formats have been defined"
msgstr "Er zijn geen afdrukformaten gedefinieerd." msgstr "Er zijn geen afdrukformaten gedefinieerd."
@ -1056,6 +1064,14 @@ msgstr "Zaterdag"
msgid "Save file..." msgid "Save file..."
msgstr "" msgstr ""
#: vpsr.rssaveformatchangestofile
msgid "Save format to file?"
msgstr ""
#: vpsr.rssaveformatchangestofilename
msgid "Save format to \"%s\"?"
msgstr ""
#: vpsr.rsselectasound #: vpsr.rsselectasound
msgid "Select A Sound" msgid "Select A Sound"
msgstr "Kies een geluid" msgstr "Kies een geluid"

View File

@ -701,6 +701,10 @@ msgstr ""
msgid "Component must be linked to a TVpControlLink" msgid "Component must be linked to a TVpControlLink"
msgstr "" msgstr ""
#: vpsr.rsnodayincrement
msgid "Day increment unit not specified."
msgstr ""
#: vpsr.rsnolocalizationfile #: vpsr.rsnolocalizationfile
msgid "Localization file not found." msgid "Localization file not found."
msgstr "" msgstr ""
@ -717,6 +721,10 @@ msgstr ""
msgid "none" msgid "none"
msgstr "" msgstr ""
#: vpsr.rsnoprintformatname
msgid "Please supply a format name"
msgstr ""
#: vpsr.rsnoprintformats #: vpsr.rsnoprintformats
msgid "No print formats have been defined" msgid "No print formats have been defined"
msgstr "" msgstr ""
@ -1046,6 +1054,14 @@ msgstr ""
msgid "Save file..." msgid "Save file..."
msgstr "" msgstr ""
#: vpsr.rssaveformatchangestofile
msgid "Save format to file?"
msgstr ""
#: vpsr.rssaveformatchangestofilename
msgid "Save format to \"%s\"?"
msgstr ""
#: vpsr.rsselectasound #: vpsr.rsselectasound
msgid "Select A Sound" msgid "Select A Sound"
msgstr "" msgstr ""

View File

@ -711,6 +711,10 @@ msgstr ""
msgid "Component must be linked to a TVpControlLink" msgid "Component must be linked to a TVpControlLink"
msgstr "" msgstr ""
#: vpsr.rsnodayincrement
msgid "Day increment unit not specified."
msgstr ""
#: vpsr.rsnolocalizationfile #: vpsr.rsnolocalizationfile
msgid "Localization file not found." msgid "Localization file not found."
msgstr "" msgstr ""
@ -727,6 +731,10 @@ msgstr "(Нет)"
msgid "none" msgid "none"
msgstr "" msgstr ""
#: vpsr.rsnoprintformatname
msgid "Please supply a format name"
msgstr ""
#: vpsr.rsnoprintformats #: vpsr.rsnoprintformats
msgid "No print formats have been defined" msgid "No print formats have been defined"
msgstr "Не определён формат печати" msgstr "Не определён формат печати"
@ -1056,6 +1064,14 @@ msgstr "Суббота"
msgid "Save file..." msgid "Save file..."
msgstr "Сохранить файл..." msgstr "Сохранить файл..."
#: vpsr.rssaveformatchangestofile
msgid "Save format to file?"
msgstr ""
#: vpsr.rssaveformatchangestofilename
msgid "Save format to \"%s\"?"
msgstr ""
#: vpsr.rsselectasound #: vpsr.rsselectasound
msgid "Select A Sound" msgid "Select A Sound"
msgstr "Выберите звук" msgstr "Выберите звук"

View File

@ -319,6 +319,10 @@ resourcestring
{ Misc strings } { Misc strings }
RSCategoryDesc = 'Category %d'; RSCategoryDesc = 'Category %d';
{ Print format list }
RSSaveFormatChangesToFile = 'Save format to file?';
RSSaveFormatChangesToFilename = 'Save format to "%s"?';
{ Print Format Editor } { Print Format Editor }
RSEditPrintFormat = 'Edit Print Formats...'; RSEditPrintFormat = 'Edit Print Formats...';
RSPrintFormatDesigner = 'Print format designer'; RSPrintFormatDesigner = 'Print format designer';
@ -332,6 +336,8 @@ resourcestring
RSNewFileBtn = 'New file'; RSNewFileBtn = 'New file';
RSLoadFileBtn = 'Load file...'; RSLoadFileBtn = 'Load file...';
RSSaveFileBtn = 'Save file...'; RSSaveFileBtn = 'Save file...';
RSNoPrintFormatName = 'Please supply a format name';
RSNoDayIncrement = 'Day increment unit not specified.';
RSReportSetup = 'Report setup'; RSReportSetup = 'Report setup';

View File

@ -188,6 +188,7 @@ object frmEditFormat: TfrmEditFormat
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Caption = 'OK' Caption = 'OK'
Default = True Default = True
ModalResult = 1
OnClick = btnOkClick OnClick = btnOkClick
TabOrder = 0 TabOrder = 0
end end
@ -203,6 +204,7 @@ object frmEditFormat: TfrmEditFormat
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Cancel = True Cancel = True
Caption = 'Cancel' Caption = 'Cancel'
ModalResult = 2
OnClick = btnCancelClick OnClick = btnCancelClick
TabOrder = 1 TabOrder = 1
end end

View File

@ -69,7 +69,7 @@ type
protected protected
procedure SaveData(AFormat: TVpPrintFormatItem); procedure SaveData(AFormat: TVpPrintFormatItem);
procedure SetData(AFormat: TVpPrintFormatItem); procedure SetData(AFormat: TVpPrintFormatItem);
function Validate: Boolean; function Validate(out AMsg: String; out AControl: TWinControl): Boolean;
public public
function Execute(AFormat: TVpPrintFormatItem) : Boolean; function Execute(AFormat: TVpPrintFormatItem) : Boolean;
end; end;
@ -100,20 +100,22 @@ begin
end; end;
procedure TfrmEditFormat.btnOkClick(Sender: TObject); procedure TfrmEditFormat.btnOkClick(Sender: TObject);
var
msg: String;
C: TWinControl;
begin begin
if Validate then if not Validate(msg, C) then
ModalResult := mrOk begin
else begin C.SetFocus;
ShowMessage('Please supply a Format Name'); MessageDlg(msg, mtError, [mbOK], 0);
edName.SetFocus; ModalResult := mrNone;
Exit;
end; end;
end; end;
function TfrmEditFormat.Execute(AFormat: TVpPrintFormatItem) : Boolean; function TfrmEditFormat.Execute(AFormat: TVpPrintFormatItem) : Boolean;
begin begin
SetData(AFormat); SetData(AFormat);
Result := ShowModal = mrOk; Result := (ShowModal = mrOk);
if Result then if Result then
SaveData(AFormat); SaveData(AFormat);
end; end;
@ -130,8 +132,7 @@ begin
AFormat.FormatName := edName.Text; AFormat.FormatName := edName.Text;
AFormat.Description := edDescription.Text; AFormat.Description := edDescription.Text;
AFormat.DayInc := udIncrement.Position; AFormat.DayInc := udIncrement.Position;
EnumVal := rgDayIncrement.ItemIndex;
EnumVal := GetEnumValue(TypeInfo(TVpDayUnits), 'du' + rgDayIncrement.Items[rgDayIncrement.ItemIndex]);
if EnumVal > -1 then if EnumVal > -1 then
AFormat.DayIncUnits := TVpDayUnits(EnumVal) AFormat.DayIncUnits := TVpDayUnits(EnumVal)
else else
@ -160,24 +161,28 @@ begin
end; end;
procedure TfrmEditFormat.SetData(AFormat: TVpPrintFormatItem); procedure TfrmEditFormat.SetData(AFormat: TVpPrintFormatItem);
var
IncName : string;
begin begin
edName.Text := AFormat.FormatName; edName.Text := AFormat.FormatName;
edDescription.Text := AFormat.Description; edDescription.Text := AFormat.Description;
udIncrement.Position := AFormat.DayInc; udIncrement.Position := AFormat.DayInc;
rgDayIncrement.ItemIndex := ord(AFormat.DayIncUnits);
IncName := GetEnumName(TypeInfo(TVpDayUnits), Ord(AFormat.DayIncUnits));
if IncName <> '' then begin
rgDayIncrement.ItemIndex := rgDayIncrement.Items.IndexOf(Copy(IncName, 3, Length(IncName) - 2));
end
else
rgDayIncrement.ItemIndex := 0;
end; end;
function TfrmEditFormat.Validate : Boolean; function TfrmEditFormat.Validate(out AMsg: String;
out AControl: TWinControl) : Boolean;
begin begin
Result := edName.Text <> ''; Result := false;
if (edName.Text = '') then begin
AMsg := RSNoPrintFormatName;
AControl := edName;
exit;
end;
if (RgDayIncrement.ItemIndex < 0) then begin
AMsg := RSNoDayIncrement;
AControl := RgDayIncrement;
exit;
end;
Result := true;
end; end;
end. end.

View File

@ -11,7 +11,7 @@ object frmPrnFormat: TfrmPrnFormat
OnCreate = FormCreate OnCreate = FormCreate
OnShow = FormShow OnShow = FormShow
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.9.0.0' LCLVersion = '1.6.4.0'
object LblFormats: TLabel object LblFormats: TLabel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner

View File

@ -246,9 +246,9 @@ begin
if IsDirty then begin if IsDirty then begin
Rslt := DirtyPrompt; Rslt := DirtyPrompt;
case Rslt of case Rslt of
ID_YES : DoSave; mrYes : DoSave;
ID_NO : ; // nothing mrNo : ; // nothing
ID_CANCEL : Exit; mrCancel : Exit;
end; end;
end; end;
@ -340,12 +340,15 @@ begin
end; end;
{=====} {=====}
function TfrmPrnFormat.DirtyPrompt: Integer; function TfrmPrnFormat.DirtyPrompt: Integer;
var
msg: String;
fn: String;
begin begin
Result := Application.MessageBox( if FormatFileName = '' then
PChar('Save changes to ' + FormatFileName + '?'), msg := RSSaveFormatChangesToFile
PChar('Inquiry'), else
MB_YESNOCANCEL or MB_ICONQUESTION msg := Format(RSSaveFormatChangesToFilename, [FormatFileName]);
); Result := MessageDlg(msg, mtConfirmation, [mbYes, mbNo, mbCancel], 0);
end; end;
{=====} {=====}
procedure TfrmPrnFormat.DoEditElement; procedure TfrmPrnFormat.DoEditElement;