summaryrefslogtreecommitdiff
path: root/demo/palmos/pilrctst.pp
blob: 09cb4f7058166781579bd58ccefadf70969982d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{ Test program for PalmOS support of FPC
  Ported from pilrctst.c by Florian Klaempfl (florian@freepascal.org)

  pilrctst.c was made by
  Wes Cherry (wesc@ricochet.net)
}
{$APPID FPCA}
{$APPNAME FPC Demo}

{$R pilrctst.rcp}

program pilrctst;

  uses
     palm;

  const
     kidForm1 = 1000;
     kidForm2 = 1001;
     kidForm3 = 1002;
     kidForm4 = 1003;
     kidForm5 = 1004;
     kidForm6 = 1005;
     kidForm7 = 1006;
     kidForm8 = 1007;
     kidForm9 = 1008;
     kidForm10 = 1009;
     kidForm11 = 1010;
     kidForm12 = 1011;
     kidFormLast = 1011;
     kidOk = 9999;
     kidTable = 1000;
     kidAlert1 = 1000;
     kidMenu1 = 1000;
     kidHelp1 = 1000;
     kidHelp2 = 1001;
     kidBitmap = 1000;

  var
     kidForm : longint;

  var
     b : boolean;
     e : EventType;
     err : word;
     pfrm : PFormType;
     ptbl : PTableType;

begin
  kidForm:=kidForm3;
  FrmGotoForm(kidForm);
  while true do
    begin
      EvtGetEvent(e,100);
      if SysHandleEvent(e)<>0 then
        continue;
      if MenuHandleEvent(nil,e,err)<>0 then
        continue;
      case e.eType of
         ctlSelectEvent:
           begin
             if e.data.controlID=kidOk then
               begin
                 inc(kidForm);
                 if kidForm>kidFormLast then
                   kidForm:=kidForm1;
                  FrmGotoForm(kidForm);
                end;
              if assigned(FrmGetActiveForm) then
                FrmHandleEvent(FrmGetActiveForm,e);
           end;
         frmLoadEvent:
           begin
             FrmSetActiveForm(FrmInitForm(e.data.formID));
           end;
         frmOpenEvent:
           begin
             pfrm:=FrmGetActiveForm;
             FrmDrawForm(pfrm);
             if e.data.formID=kidForm12 then
               begin
                 ptbl:=PTableType(FrmGetObjectPtr(pfrm, FrmGetObjectIndex(pfrm, kidTable)));
                 TblSetColumnUsable(ptbl, 0, true);
                 TblSetColumnUsable(ptbl, 1, true);
                 TblSetColumnUsable(ptbl, 2, true);
                 TblSetColumnUsable(ptbl, 3, true);
                 TblSetColumnUsable(ptbl, 4, true);
                 TblSetRowUsable(ptbl, 0, true);
                 TblSetRowUsable(ptbl, 1, true);

                 TblSetItemStyle(ptbl, 0, 0, textTableItem);
                 TblSetItemStyle(ptbl, 1, 0, textTableItem);
                 TblSetItemStyle(ptbl, 2, 0, textTableItem);
                 TblDrawTable(ptbl);
               end;
            end;
         menuEvent:
           FrmAlert(kidAlert1);
         appStopEvent:
           break;
         else
           if assigned(FrmGetActiveForm) then
             FrmHandleEvent(FrmGetActiveForm,e);
      end;
    end;
end.