home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / hypercar / 3184 < prev    next >
Encoding:
Internet Message Format  |  1992-08-21  |  2.0 KB

  1. Path: sparky!uunet!mcsun!sunic!random.se!ianf
  2. Date: Sat, 22 Aug 92 00:17:35 +0200
  3. From: ianf@random.se (Ian Feldman)
  4. Newsgroups: comp.sys.mac.hypercard
  5. X-Hear: Sally's (Meg Ryan's) fake diner orgasm now available as plug-in
  6. X-This: charger sound for the Apple PowerBook; reason enough to buy one
  7. Apparently-To: rnews@sunet.se
  8. Message-ID: <a6bb3818@random.se>
  9. X-Mailer: Fernmail 1.2b2
  10. Organization: random design -- "Opinions, cheaply"
  11. Lines: 40
  12. Subject: trapping arrowkeys INSIDE a mouseWithin handler
  13.  
  14.  
  15.   Is there a more _optimal/_faster_ way to detect possible arrow
  16.   presses WHILE mouse rests above a field with an important
  17.   mouseWithin handler?  The latter takes care of all detection
  18.   of (equivalent to) mouseDown, mouseStillDown, mouseUp and
  19.   mouseLeave events faster and with a higher degree of precision
  20.   than separate handlers for each would allow.  Now I'd like to
  21.   enhance it still, be adding detection of left and right arrow
  22.   keys, to permit going to prev/ next card even the mouseWithin
  23.   loop is executing.
  24.  
  25.  
  26.  on mouseWithin                       --example of working code;
  27.    repeat while <condition>
  28.    ----[code]
  29.  
  30.    watch4arrows numtochar(inkey())-27 --returns "1" or "2" if left
  31.                                       --or right arrow key pressed;
  32.    ----[code]                         --other values ignored;
  33.    end repeat
  34.  end mouseWithin
  35.  
  36.  on watch4arrows keyValue             --if left or right arrow then
  37.    if param(1) is in "12"             --go in the indicated direction;
  38.    then do "go" &&item param(1) of "prev cd,next cd" &&"of this bg"
  39.  end watch4arrows
  40.  
  41.  
  42.   Using keyDown message of HyperCard 2.0 is NOT an option since
  43.   it'd require a private handler of its own.  That's why I had to
  44.   employ the inkey XFCN by Guy Picciotto [sp?]. Unfortunately it
  45.   doesn't work when the command key is also down, thus preventing
  46.   detection and possible simulation of HC's hardwired cmd-left-
  47.   arrow/ cmd-right-arrow actions (=go to first/ go to last card).
  48.  
  49.   Or am I, perhaps, missing something VERY obvious?
  50.  
  51.  
  52. ----Please reply SOLELY via email ------> ianf@random.se
  53.