home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / easygui_os12 / examples / easygui / testkey_os12.e < prev    next >
Encoding:
Text File  |  2000-06-05  |  2.9 KB  |  97 lines

  1. -> testkey.e - shows use of keyboard short-cuts
  2.  
  3. OPT PREPROCESS
  4.  
  5. -> RST: Added conditional EASY_OS12 support
  6. #define EASY_OS12
  7.  
  8. #ifdef EASY_OS12
  9.   MODULE 'tools/easygui_os12'
  10. #endif
  11. #ifndef EASY_OS12
  12.   OPT OSVERSION=37
  13.   MODULE 'tools/easygui'
  14. #endif
  15.  
  16. MODULE 'exec/lists', 'exec/nodes',
  17.        'graphics/text',
  18.        'amigalib/lists'
  19.  
  20. CONST MAXLEN=20
  21.  
  22. DEF gad, disabled=TRUE
  23.  
  24. PROC main()
  25.   DEF s[MAXLEN]:STRING, list:lh, choices
  26.   newList(list)
  27.   AddTail(list, [0,0,0,0,'Item']:ln)
  28.   AddTail(list, [0,0,0,0,'Item-2']:ln)
  29.   AddTail(list, [0,0,0,0,'Item-3']:ln)
  30.   AddTail(list, [0,0,0,0,'Item-4']:ln)
  31.   AddTail(list, [0,0,0,0,'Item-5']:ln)
  32.   AddTail(list, [0,0,0,0,'Item-6']:ln)
  33.   choices:=['Zero','One','Two',NIL]
  34.   StrCopy(s,'Hello')
  35.   easyguiA('Press Some Keys!',
  36.           [COLS,
  37.              [EQROWS,
  38.                 [CYCLE,{cycle},'_Cycle:',choices,1,0,"c"],
  39.                 [STR,{password},'S_tring:',s,MAXLEN,5,FALSE,0,"t"],
  40.                 [BAR],
  41.                 -> Show new CHECK and MX alignments
  42.                 [CHECK,{check},'C_heck:',TRUE,TRUE,0,"h"],
  43.                 [MX,{mx},'_MX:',choices,TRUE,0,0,"m"],
  44.                 [BAR],
  45.                 -> Show new CHECK and MX right text
  46.                 [CHECK,{check2},'Ch_eck2 (Right)',TRUE,FALSE,0,"e"],
  47.                 [MX,{mx2},'M_X2 (Right)',choices,FALSE,0,0,"x"]
  48.              ],
  49.              [BAR],
  50.              [ROWS,
  51.                 -> Show new LISTV label and show selected
  52.                 [LISTV,{listv},'_List:',8,5,list,FALSE,1,0,0,"l",0],
  53.                 [SLIDE,{slide},'_Slide:',FALSE,1,8,3,3,'',0,"s"],
  54. ->                [SCROLL,{slide},FALSE,80,10,3,3,0,"i"],
  55.                 -> Show new PALETTE current field, min size and show selected
  56.                 [PALETTE,{palette},'_Palette:',3,5,2,2,0,"p"],
  57.                 gad:=[SBUTTON,{button},'_blockwin()',0,"b",0,disabled],
  58.                 [SBUTTON,{disable},'_disable()',0,"d"]
  59.              ]
  60.           ])
  61. ENDPROC
  62.  
  63. PROC button(gh) HANDLE
  64.   blockwin(gh)
  65.   easyguiA('New GUI',
  66.           [ROWS,
  67.              [TEXT,'Old GUI blocked',NIL,TRUE,15],
  68.              [BUTTON,0,'_Unblock',0,"u"]
  69.           ])
  70. EXCEPT DO
  71.   unblockwin(gh)
  72.   ReThrow()
  73. ENDPROC
  74.  
  75. PROC disable(gh)
  76.   disabled:=disabled=FALSE
  77.   setdisabled(gh,gad,disabled)
  78. ENDPROC
  79.  
  80. PROC slide(info,val) IS    WriteF('Slide has moved to \d\n', val)
  81.  
  82. PROC cycle(info,val) IS    WriteF('Cycle choice is now \d\n', val)
  83.  
  84. PROC check(info,val) IS    WriteF('Check is now \s\n',
  85.                                  IF val THEN 'TRUE' ELSE 'FALSE')
  86. PROC check2(info,val) IS   WriteF('Check2 is now \s\n',
  87.                                   IF val THEN 'TRUE' ELSE 'FALSE')
  88.  
  89. PROC mx(info,val) IS       WriteF('MX choice is now \d\n', val)
  90. PROC mx2(info,val) IS      WriteF('MX2 choice is now \d\n', val)
  91.  
  92. PROC password(info,val) IS WriteF('Password is now "\s"\n', val)
  93.  
  94. PROC palette(info,val) IS  WriteF('Palette pen is now \d\n', val)
  95.  
  96. PROC listv(info,val) IS    WriteF('List selection moved to \d\n', val)
  97.