pilrctst.pp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. { Test program for PalmOS support of FPC
  2. Ported from pilrctst.c by Florian Klaempfl ([email protected])
  3. pilrctst.c was made by
  4. Wes Cherry ([email protected])
  5. }
  6. {$APPID FPCA}
  7. {$APPNAME FPC Demo}
  8. program pilrctst;
  9. uses
  10. palm;
  11. const
  12. kidForm1 = 1000;
  13. kidForm2 = 1001;
  14. kidForm3 = 1002;
  15. kidForm4 = 1003;
  16. kidForm5 = 1004;
  17. kidForm6 = 1005;
  18. kidForm7 = 1006;
  19. kidForm8 = 1007;
  20. kidForm9 = 1008;
  21. kidForm10 = 1009;
  22. kidForm11 = 1010;
  23. kidForm12 = 1011;
  24. kidFormLast = 1011;
  25. kidOk = 9999;
  26. kidTable = 1000;
  27. kidAlert1 = 1000;
  28. kidMenu1 = 1000;
  29. kidHelp1 = 1000;
  30. kidHelp2 = 1001;
  31. kidBitmap = 1000;
  32. var
  33. kidForm : longint;
  34. function PilotMain(_cmd : Word;_cmdPBP : Ptr;_launchFlags : Word) : DWord;cdecl;public;[alias: 'PilotMain'];
  35. var
  36. b : boolean;
  37. e : EventType;
  38. err : word;
  39. pfrm : PFormType;
  40. ptbl : PTableType;
  41. begin
  42. if _cmd=0 then
  43. begin
  44. kidForm:=kidForm1;
  45. FrmGotoForm(kidForm);
  46. while true do
  47. begin
  48. EvtGetEvent(e,100);
  49. if SysHandleEvent(e)<>0 then
  50. continue;
  51. if MenuHandleEvent(nil,e,err)<>0 then
  52. continue;
  53. case e.eType of
  54. ctlSelectEvent:
  55. begin
  56. if e.data.controlID=kidOk then
  57. begin
  58. inc(kidForm);
  59. if kidForm>kidFormLast then
  60. kidForm:=kidForm1;
  61. FrmGotoForm(kidForm);
  62. end;
  63. if assigned(FrmGetActiveForm) then
  64. FrmHandleEvent(FrmGetActiveForm,e);
  65. end;
  66. frmLoadEvent:
  67. begin
  68. FrmSetActiveForm(FrmInitForm(e.data.formID));
  69. end;
  70. frmOpenEvent:
  71. begin
  72. pfrm:=FrmGetActiveForm;
  73. FrmDrawForm(pfrm);
  74. if e.data.formID=kidForm12 then
  75. begin
  76. ptbl:=PTableType(FrmGetObjectPtr(pfrm, FrmGetObjectIndex(pfrm, kidTable)));
  77. TblSetColumnUsable(ptbl, 0, true);
  78. TblSetColumnUsable(ptbl, 1, true);
  79. TblSetColumnUsable(ptbl, 2, true);
  80. TblSetColumnUsable(ptbl, 3, true);
  81. TblSetColumnUsable(ptbl, 4, true);
  82. TblSetRowUsable(ptbl, 0, true);
  83. TblSetRowUsable(ptbl, 1, true);
  84. TblSetItemStyle(ptbl, 0, 0, textTableItem);
  85. TblSetItemStyle(ptbl, 1, 0, textTableItem);
  86. TblSetItemStyle(ptbl, 2, 0, textTableItem);
  87. TblDrawTable(ptbl);
  88. end;
  89. end;
  90. menuEvent:
  91. FrmAlert(kidAlert1);
  92. appStopEvent:
  93. break;
  94. else
  95. if assigned(FrmGetActiveForm) then
  96. FrmHandleEvent(FrmGetActiveForm,e);
  97. end;
  98. end;
  99. end;
  100. PilotMain:=0;
  101. end;
  102. begin
  103. end.