home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / rexxintuition_463.lzh / RexxIntuition / RexxIntui.lzh / scripts / ILBM.rexx < prev    next >
OS/2 REXX Batch file  |  1990-06-27  |  2KB  |  56 lines

  1. /* ILBMViewer - An example of using the dissidents rx_intui.library */
  2.  
  3. /* Present File requester for user to pick the picture to load */
  4. /* Get a FileIO structure */
  5. fileio=GetFIO()
  6. IF fileio == '' | fileio == 0 THEN SAY 'FileIO allocation error'
  7.  
  8. /* Do the File Requester with INFO_SUPPRESS. Since we pass 0 for screen, this */
  9. /* opens on WB. Note: If no FileIO, this does nothing and returns path = null. */
  10. path=FioWindow(fileio,'Choose Picture File:',128,,,,,0)
  11.  
  12. /* Free the FileIO. If no FileIO, this does nothing. */
  13. err=EndFIO(fileio)
  14.  
  15. IF path > '' THEN DO
  16.  
  17. /* Let the lib open a window/screen for us, and load the picture. */
  18. wind=IFFLoad(0,0,path)
  19. IF wind == '' | wind == 0 THEN SAY 'Window open error'
  20.  
  21. /* Trap the RIGHT MOUSE button so that we can use it for ourselves. We're */
  22. /* going to use the menu button to bring up the color requester, and the  */
  23. /* select button to exit the program */
  24. err=ModIDCMP(wind,,,65536)
  25.  
  26. /* Get the window's screen. If no window, this returns 0 for screen */
  27. screen=PEEK(wind,46,2)
  28.  
  29. /* Here's our IDCMP loop. When the lib opens a window, it's default IDCMP is */
  30. /* MOUSEBUTTONS only. If no window (ie 0), this loop breaks out immediately. */
  31. class = 1
  32.  
  33. DO WHILE class > 0
  34. spec=WaitMsg(wind)
  35. /* divide the spec into separate parts */
  36. PARSE var spec class part1 part2 part3
  37.  
  38. IF class == 3 THEN DO
  39. /* If select DOWN, set class to 0 */
  40. IF part1 == 0 THEN class = 0
  41. /* If menu DOWN, bring up the color requester */
  42. IF part1 == 2 THEN err=Color(screen)
  43. END
  44.  
  45. END
  46.  
  47. /* Close the window that the lib opened, thus freeing any resources for it. */
  48. /* Note that if no window opened (ie 0), this does nothing. */
  49. err=EndWindow(wind)
  50.  
  51. /* Close the screen that the lib opened, thus freeing any resources for it. */
  52. /* Note that if no screen opened (ie 0), this does nothing. */
  53. err=EndScreen(screen)
  54.  
  55. END
  56.