HelpNDoc 파스칼 스크립트는 구조를 지원합니까? (Does HelpNDoc Pascal Script support structures?)


문제 설명

HelpNDoc 파스칼 스크립트는 구조를 지원합니까? (Does HelpNDoc Pascal Script support structures?)

구조를 만들려고 합니다.

MyTopic
    TopicID : String;
    HelpID : Integer;

이 구조를 정렬할 수 있도록 배열을 만들고 싶었습니다.

유형을 사용해 보았습니다. / record 구문이지만 실패합니다.

Update

type절차를 정의했습니다. :

type
    TMyTopicRecord = record
        idTopic : String;
        idContextHelp : integer;
    End;

procedure GetSortedTopicIDs(aTopics : array of String; size : Integer);
var
    aMyTopicRecords : array of TMyTopicRecord;
    temp : TMyTopicRecord;
    iTopic, i, j : Integer;
begin
    // Init the array
    SetLength(aMyTopicRecords, size); 

    // Fill the array with the existing topid ids.
    // Get the context ids at the same time.
    for iTopic := 0 to size ‑ 1 do
        aMyTopicRecords[iTopic].idTopic := aTopics[iTopic];
        aMyTopicRecords[iTopic].idContextHelp := HndTopics.GetTopicHelpContext(aTopics[iTopic]);

    // Sort the array on context id
    for i := size‑1 DownTo 1 do
    for j := 2 to i do
        if (aMyTopicRecords[j‑1].idContextHelp > aMyTopicRecords[j].idContextHelp) Then
        begin
            temp := aMyTopicRecords[j‑1];
            aMyTopicRecords[j‑1] := aMyTopicRecords[j];
            aMyTopicRecords[j] := temp;
        end;

    // Rebuild the original array of topic ids
    for iTopic := 0 to size ‑ 1 do
        aTopics[iTopic] := aMyTopicRecords[iTopic].idTopic;
end;

프로시저가 parent 함수의 루프에서 호출됩니다(코드 잘림).

function GetKeywordsAsHtml(): string;
var
    aKeywordList: THndKeywordsInfoArray;
    aAssociatedTopics: array of string;
    nBlocLevel, nDif, nClose, nCurKeywordLevel, nCurKeywordChildrenCnt: Integer;
    nCurKeyword, nCurKeywordTopic: Integer;
    nCountAssociatedTopics: Integer;
    sCurrentKeyword, sKeywordLink, sKeywordRelated: string;
    sKeywordJsCaption: string;
begin
    Result := '<ul>';
    nBlocLevel := 0;
    try
        aKeywordList := HndKeywords.GetKeywordList(False);
        for nCurKeyword := 0 to length(aKeywordList) ‑ 1 do
        begin
            sCurrentKeyword := aKeywordList[nCurKeyword].id;
            nCurKeywordLevel := HndKeywords.GetKeywordLevel(sCurrentKeyword);
            nCurKeywordChildrenCnt := HndKeywords.GetKeywordDirectChildrenCount(sCurrentKeyword);

            sKeywordLink := '#';
            sKeywordRelated := '[]';

            aAssociatedTopics := HndTopicsKeywords.GetTopicsAssociatedWithKeyword(sCurrentKeyword);
            nCountAssociatedTopics := Length(aAssociatedTopics);
            if nCountAssociatedTopics > 0 then
            begin
                GetSortedTopicIDs(aAssociatedTopics, nCountAssociatedTopics);
                // Code snipped
            end;
        end;
    finally
        Result := Result + '</ul>';
    end;
end;

스크립트가 컴파일됨 문제 없이 HelpNDoc 내부 편집기에 있습니다. 그러나 실제로 HTML 문서를 작성하려고 할 때 문제가 발생합니다.

procedure GetSortedTopicIDs(var aTopics : array of String; iNumTopics : Integer); var iTopic : Integer; // List of output aList: TStringList; begin // Init list aList := TStringList.Create; // Build a new array of "nnn x" // ‑ nnn is the help context id // ‑ x is the topid id // Note: I know that the context ID values are within the range 0 ‑ 200 for iTopic := 0 to iNumTopics ‑ 1 do // We pad the context id with 0. We could increase the padding width to // make the script mre useful aList.Add(Format('%0.3d %s', [ HndTopics.GetTopicHelpContext(aTopics[iTopic]), aTopics[iTopic] ])); // Now we sort the new array (which basically sorts it by context id) aList.Sort; // Update original array for iTopic := 0 to iNumTopics ‑ 1 do // We ignore the "nnn " part of the string to get just the topic id aTopics[iTopic] := copy(aList[iTopic],5, length(aList[iTopic])‑4); // Tidy up aList.Free; end;

This compiles and I get the sorted array of topic IDs at the end of it. So the pop‑up help is now listed as I want.

(by Andrew TruckleAndrew Truckle)

참조 문서

  1. Does HelpNDoc Pascal Script support structures? (CC BY‑SA 2.5/3.0/4.0)

#pascalscript #helpndoc






관련 질문

Inno Setup의 WizardForm 페이지에서 레이블 텍스트 변경 (Changing label texts on WizardForm page in Inno Setup)

파스칼스크립트 디버깅 중에 양식 양식을 일시 중단할 수 있습니까? (Can a forms modality be suspended during pascalscript debugging?)

Inno Setup: .NET Framework 설치, 시스템 재부팅 후 설치 계속 (Inno Setup: Install .NET framework, reboot the system and continue installation)

Inno Setup - [code] 내부의 기본 경로 정의 (Inno Setup - Defining a default path inside [code])

파스칼스크립트에 DLL 함수 등록하기 (Registering DLL-Functions in Pascalscript)

HelpNDoc 파스칼 스크립트는 구조를 지원합니까? (Does HelpNDoc Pascal Script support structures?)

하위 설치 다운로드 및 실행 - Inno Download Plugin 다운로드 중에 진행률 표시줄이 이동하지 않음 (Download and run sub install - Inno Download Plugin progress bar does not move during download)

TBitmapImage는 Inno Setup 6에서 크기 조정된 디스플레이의 크기보다 크게 렌더링됩니다. (TBitmapImage is rendered larger than its size on scaled display in Inno Setup 6)

Inno Setup에서 필요할 때 시작 화면을 표시하지 않으려면 어떻게 해야 합니까? (How can I prevent showing the splash screen when I need it in Inno Setup?)

Inno Setup을 사용하여 현재 날짜를 레지스트리에 바이너리 형식으로 저장 (Storing the current date to the registry in binary format with Inno Setup)

Inno Setup 설치 프로그램 이전의 시작 화면에 이미지가 표시되지 않음 (Image on a splash screen before Inno Setup installer does not display)

Inno Setup 단어 완성이 전혀 작동하지 않습니다 (Inno Setup word completion doesn't work at all)







코멘트