Subversion Repositories oidplus

Rev

Rev 735 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 735 Rev 747
Line 1... Line 1...
1
program LISTTEST;
1
program LISTTEST;
2
 
2
 
3
(************************************************)
3
(************************************************)
4
(* LISTTEST.PAS                                 *)
4
(* LISTTEST.PAS                                 *)
5
(* Author:   Daniel Marschall                   *)
5
(* Author:   Daniel Marschall                   *)
6
(* Revision: 2022-02-13                         *)
6
(* Revision: 2022-02-16                         *)
7
(* License:  Apache 2.0                         *)
7
(* License:  Apache 2.0                         *)
8
(* This file contains:                          *)
8
(* This file contains:                          *)
9
(* - Example how to use lists and selection CUI *)
9
(* - Example how to use lists and selection CUI *)
10
(************************************************)
10
(************************************************)
11
 
11
 
12
uses
12
uses
13
  Crt, StrList, VtsCui;
13
  Crt, Drivers, StrList, VtsCui;
14
 
14
 
15
var
15
var
16
  items: PStringList;
16
  items: PStringList;
17
  i, itemIndex: integer;
17
  i, itemIndex: integer;
18
  sTmp: string;
18
  sTmp: string;
19
begin
19
begin
-
 
20
  InitVideo;
-
 
21
  CursorOff;
-
 
22
 
20
  InitList(items);
23
  CreateList(items);
21
 
24
 
22
  (* Fill the list for testing *)
25
  (* Fill the list for testing *)
23
  for i := 1 to 5 do
26
  for i := 1 to 5 do
24
  begin
27
  begin
25
    str(i, sTmp);
28
    str(i, sTmp);
26
    ListAppend(items, 'list item '+sTmp);
29
    ListAppend(items, 'list item '+sTmp);
27
  end;
30
  end;
28
 
31
 
29
  (* Do inserts and deletions to test their functionality *)
32
  (* Do inserts and deletions to test their functionality *)
30
  ListInsert(items, 'TEST', 0);
33
  ListInsert(items, 'TEST', 0);
31
  ListDeleteElement(items, 0);
34
  ListDeleteElementByIndex(items, 0);
32
  ListDeleteElement(items, 0);
35
  ListDeleteElementByIndex(items, 0);
33
  ListInsert(items, 'FirstElement', 0);
36
  ListInsert(items, 'FirstElement', 0);
34
 
37
 
35
  (* Test the selection GUI unit *)
38
  (* Test the selection GUI unit *)
36
  ClrScr;
39
  ClrScr;
37
  itemIndex := DrawSelectionList(3, 5, 15, 10, items, true, 0);
40
  itemIndex := DrawSelectionList(3, 5, 15, 10, items, true, '', 0);
-
 
41
  ResetDefaultDosColors;
38
  ClrScr;
42
  ClrScr;
39
  if itemIndex = -1 then
43
  if itemIndex = -1 then
40
  begin
44
  begin
41
    WriteLn('Nothing was selected.');
45
    WriteLn('Nothing was selected.');
42
  end
46
  end
Line 47... Line 51...
47
  WriteLn('Press RETURN to return to DOS.');
51
  WriteLn('Press RETURN to return to DOS.');
48
 
52
 
49
  FreeList(items);
53
  FreeList(items);
50
 
54
 
51
  ReadLn;
55
  ReadLn;
-
 
56
 
-
 
57
  CursorOn;
-
 
58
  DoneVideo;
52
end.
59
end.