home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / easygui_os12 / examples / easyplugins / bar_os12_demo.e next >
Encoding:
Text File  |  2000-06-06  |  2.6 KB  |  110 lines

  1.  
  2. /*
  3.  
  4. */
  5.  
  6. OPT PREPROCESS
  7.  
  8. -> RST: Added conditional EASY_OS12 support
  9. #define EASY_OS12
  10.  
  11. #ifdef EASY_OS12
  12.   MODULE 'tools/easygui_os12', 'easyplugins/bar_os12', 'hybrid/utility'
  13. #endif
  14. #ifndef EASY_OS12
  15.   OPT OSVERSION=37
  16.   MODULE 'tools/easygui', 'easyplugins/bar', 'utility'
  17. #endif
  18.  
  19. MODULE 'utility/tagitem'
  20.  
  21. DEF bar_1:PTR TO bar_plugin,
  22.     bar_2:PTR TO bar_plugin,
  23.     bar_3:PTR TO bar_plugin,
  24.     bar_4:PTR TO bar_plugin,
  25.     work[64]:STRING,
  26.     t1:PTR TO LONG, t2:PTR TO LONG,
  27.     t3:PTR TO LONG, t4:PTR TO LONG
  28.  
  29. PROC main() HANDLE
  30.  
  31. #ifdef EASY_OS12
  32.     openUtility()
  33. #endif
  34. #ifndef EASY_OS12
  35.     IF (utilitybase:=OpenLibrary('utility.library', 37))=NIL THEN Raise("utlb")
  36. #endif
  37.  
  38.     Rnd(-VbeamPos())
  39.  
  40.     NEW bar_1.bar([PLA_Bar_Percent,   100,
  41.                    TAG_DONE]),
  42.         bar_2.bar([PLA_Bar_Percent,   30,
  43.                    TAG_DONE]),
  44.         bar_3.bar([PLA_Bar_Percent,   100,
  45.                    PLA_Bar_Vertical,  TRUE,
  46.                    TAG_DONE]),
  47.         bar_4.bar([PLA_Bar_Percent,   65,
  48.                    PLA_Bar_Vertical,  TRUE,
  49.                    TAG_DONE])
  50.  
  51.     easyguiA('bar_plugin example', [ROWS,
  52.                                        [SPACEV], [PLUGIN, 1, bar_1], [SPACEV], t1:=[TEXT, '100%', NIL, TRUE, 1],
  53.                                        [SPACEV], [PLUGIN, 1, bar_2], [SPACEV], t2:=[TEXT, '30%', NIL, TRUE, 1],
  54.                                        [SPACEV],
  55.                                        [EQCOLS,
  56.                                             [ROWS, [PLUGIN, 1, bar_3], t3:=[TEXT, '100%', NIL, TRUE, 1]],
  57.                                             [ROWS, [PLUGIN, 1, bar_4], t4:=[TEXT, '65%', NIL, TRUE, 1]]
  58.                                        ],
  59.                                        [SPACEV],
  60.                                        [EQCOLS,
  61.                                            [SBUTTON, {random}, 'Random'],
  62.                                            [SPACEH],
  63.                                            [SBUTTON, NIL, 'Quit']
  64.                                        ]
  65.                                    ])
  66.  
  67. EXCEPT DO
  68.  
  69.     END bar_1, bar_2, bar_3, bar_4
  70.  
  71. #ifdef EASY_OS12
  72.     closeUtility()
  73. #endif
  74. #ifndef EASY_OS12
  75.     IF utilitybase THEN CloseLibrary(utilitybase)
  76. #endif
  77.  
  78. ENDPROC
  79.  
  80. PROC random(gh:PTR TO guihandle)
  81.  
  82.     DEF r
  83.  
  84.     r:=Rnd(101)
  85.  
  86.     bar_1.set(PLA_Bar_Percent, r)
  87.  
  88.     settext(gh, t1, StringF(work, '\d%', r))
  89.  
  90.     r:=Rnd(101)
  91.  
  92.     bar_2.set(PLA_Bar_Percent, r)
  93.  
  94.     settext(gh, t2, StringF(work, '\d%', r))
  95.  
  96.     r:=Rnd(101)
  97.  
  98.     bar_3.set(PLA_Bar_Percent, r)
  99.  
  100.     settext(gh, t3, StringF(work, '\d%', r))
  101.  
  102.     r:=Rnd(101)
  103.  
  104.     bar_4.set(PLA_Bar_Percent, r)
  105.  
  106.     settext(gh, t4, StringF(work, '\d%', r))
  107.  
  108. ENDPROC
  109.  
  110.