You've already forked lazarus-ccr
LazStats: Rename LazStats.ini to LazStats.hlp. Update ContextHelpUnit.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7828 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -38,7 +38,7 @@ object ContextHelpForm: TContextHelpForm
|
|||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object Memo1: TMemo
|
object HelpMemo: TMemo
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
|
@ -6,7 +6,7 @@ unit ContextHelpUnit;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
IniFiles, Classes, SysUtils, FileUtil, Forms, Controls, Graphics,
|
IniFiles, Classes, SysUtils, Forms, Controls, Graphics,
|
||||||
Dialogs, ExtCtrls, StdCtrls;
|
Dialogs, ExtCtrls, StdCtrls;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -15,14 +15,12 @@ type
|
|||||||
|
|
||||||
TContextHelpForm = class(TForm)
|
TContextHelpForm = class(TForm)
|
||||||
Button1: TButton;
|
Button1: TButton;
|
||||||
Memo1: TMemo;
|
HelpMemo: TMemo;
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
procedure Button1Click(Sender: TObject);
|
procedure Button1Click(Sender: TObject);
|
||||||
private
|
private
|
||||||
{ private declarations }
|
|
||||||
public
|
public
|
||||||
{ public declarations }
|
procedure HelpMessage(ATag: integer);
|
||||||
procedure HelpMessage(lTag: integer);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -32,39 +30,45 @@ implementation
|
|||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
function ReadIniFileTag(var lTag: Integer): string;
|
// Read string with index ATag
|
||||||
//Read string with index lTag
|
function ReadHlpFileTag(var ATag: Integer): string;
|
||||||
var
|
var
|
||||||
lIniFile: TIniFile;
|
lIniFile: TIniFile;
|
||||||
lFileName, lLang: string;
|
lFileName, lLang: string;
|
||||||
begin
|
begin
|
||||||
lFilename := ChangeFileExt(ParamStr(0), '.ini');
|
lFilename := ChangeFileExt(ParamStr(0), '.hlp');
|
||||||
if (not FileExists(lFilename)) then begin
|
|
||||||
Result := 'No contextual help: unable to find '+lFilename;
|
if not FileExists(lFilename) then begin
|
||||||
|
Result := 'No context help: unable to find helo file "' + lFilename + '"';
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
Result := 'No contextual help found for '+IntToStr(lTag);
|
|
||||||
lIniFile := TIniFile.Create(lFilename);
|
lIniFile := TIniFile.Create(lFilename);
|
||||||
try
|
try
|
||||||
lLang := lIniFile.ReadString('LANGUAGE', 'DEFAULT', '');
|
lLang := lIniFile.ReadString('LANGUAGE', 'DEFAULT', '');
|
||||||
Result := lIniFile.ReadString(lLang, IntToStr(lTag), Result);
|
Result := lIniFile.ReadString(lLang, IntToStr(ATag), Result);
|
||||||
Result := StringReplace(Result, '\n', LineEnding, [rfIgnoreCase, rfReplaceAll]);
|
if Result <> '' then
|
||||||
|
Result := StringReplace(Result, '\n', LineEnding, [rfIgnoreCase, rfReplaceAll])
|
||||||
|
else
|
||||||
|
Result := 'No context help found for ' + IntToStr(ATag);
|
||||||
finally
|
finally
|
||||||
lIniFile.Free;
|
lIniFile.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TContextHelpForm.Button1Click(Sender: TObject);
|
procedure TContextHelpForm.Button1Click(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Close;
|
Close;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TContextHelpForm.HelpMessage(lTag: integer);
|
|
||||||
|
procedure TContextHelpForm.HelpMessage(ATag: integer);
|
||||||
begin
|
begin
|
||||||
Memo1.Lines.Clear;
|
HelpMemo.Lines.Text := ReadHlpFileTag(ATag);
|
||||||
Memo1.Lines.Text := ReadIniFileTag(lTag);
|
|
||||||
Show;
|
Show;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user