I have seen several questions about Insertion Sort with Pascal. So I thought I would try it out with an array strings.
The text values:
Advanced IF Syntax
Advanced LOOP Syntax
ALIGN
BANNER / NOBANNER
BLANK
COLOR / COLOUR
CONG_MEET_TIME
DATE
ENDPAGE
EOL
FIELD
FONT
HIGHLIGHT / NOHIGHLIGHT
IF
IMAGE
INCLUDE
LINESPACING
LOOKUP_FIELD
LOOP
LOOP AS
LOOP SQL
PARAGRAPH / TEXT
REQUIRES
Script Command Syntax
SEPARATOR
TAB
TAB SET
TALK_THEME
Here is the code:
Procedure InsertionSort(aTopics : Array of String; size : Integer);
Var
i, j : Integer;
caption, topic_id : String;
Begin
For i := 2 to size-1 do
Begin
topic_id := aTopics[i];
caption := HndTopics.GetTopicCaption(aTopics[i]);
j := i;
While ((j > 1) AND (CompareText(HndTopics.GetTopicCaption(aTopics[j-1]), caption) > 0)) do
Begin
aTopics[j] := aTopics[j-1];
j := j - 1;
End;
aTopics[j] := topic_id;
End;
End;
It seems to be working 99% correct with one exception. Go to the help documentation and click on the Index tab. Click on the Custom Script Command Syntax item and a pop-up will display:
Why is the first item TALK_THEME
? That should be at the end of the list, not the start.