home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / amigae / e_v3.2a / rkrmsrc / intuition / screens / newlookscreen.e < prev    next >
Text File  |  1977-12-31  |  2KB  |  48 lines

  1. -> newlookscreen.e - open a screen with the "new look"
  2.  
  3. -> E-Note: you need to be more specific about modules than C does about includes
  4. MODULE 'intuition/screens' -> Screen data structures and tags
  5.  
  6. -> Exception values
  7. -> E-Note: exceptions are a much better way of handling errors
  8. ENUM ERR_NONE, ERR_SCRN, ERR_KICK
  9.  
  10. -> Automatically raise exceptions
  11. -> E-Note: these take care of a lot of error cases
  12. RAISE ERR_SCRN IF OpenScreenTagList()=NIL
  13.  
  14. -> Simple routine to demonstrate opening a screen with the new look.  Simply
  15. -> supply the tag SA_PENS along with a minimal pen specification, Intuition
  16. -> will fill in all unspecified values with defaults.  Since we are not
  17. -> supplying values, all are Intuition defaults.
  18. PROC main() HANDLE
  19.   DEF my_screen=NIL:PTR TO screen
  20.  
  21.   -> E-Note: E automatically opens the Intuition library
  22.  
  23.   -> E-Note: use KickVersion rather than checking library version
  24.   -> E-Note: Raise() exception rather than nesting conditionals
  25.   IF KickVersion(37)=FALSE THEN Raise(ERR_KICK)
  26.  
  27.   -> The screen is opened two bitplanes deep so that the new look will show
  28.   -> up better.
  29.   -> E-Note: automatically error-checked (automatic exception)
  30.   -> E-Note: pens is just a INT-typed list
  31.   my_screen:=OpenScreenTagList(NIL,
  32.                               [SA_PENS, [-1]:INT,
  33.                                SA_DEPTH, 2,
  34.                                NIL])
  35.  
  36.   -> Screen successfully opened
  37.   Delay(30)  -> Normally the program would be here
  38.  
  39.   -> E-Note: exit and clean up via handler
  40. EXCEPT DO
  41.   IF my_screen THEN CloseScreen(my_screen)
  42.   -> E-Note: we can print a minimal error message
  43.   SELECT exception
  44.   CASE ERR_SCRN; WriteF('Error: Failed to open custom screen\n')
  45.   CASE ERR_KICK; WriteF('Error: Needs Kickstart V37+\n')
  46.   ENDSELECT
  47. ENDPROC
  48.