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