home *** CD-ROM | disk | FTP | other *** search
/ Star Trek Starfleet Academy Mini Omnipedia / MINI_OMNI.ISO / pc / omni_v2.dxr / 00407_WinkeyParent.ls < prev    next >
Encoding:
Text File  |  1996-04-15  |  2.9 KB  |  119 lines

  1. global gHoldSearchInfo, gLastWinLeft, gLastWinTop, gActiveWin, gWinOffSet, gInputField, gTimeRunningF, gWinLocRootT, gWinLocRootL, gWinLocCounter
  2.  
  3. on birth me
  4.   global gComputerModel
  5.   set gComputerModel to #mpc
  6.   return me
  7. end
  8.  
  9. on mSetBasicMouseUp me, pWindow
  10.   tell pWindow
  11.     set the mouseUpScript to "mWinMouseUP(oWinKey)"
  12.   end tell
  13. end
  14.  
  15. on mWinMouseUp me
  16.   if the shiftDown then
  17.     set gLastWinLeft to getAt(the rect of window gActiveWin, 1) + gWinOffSet
  18.     set gLastWinTop to getAt(the rect of window gActiveWin, 2) + gWinOffSet
  19.     set gWinLocRootL to getAt(the rect of window gActiveWin, 1)
  20.     set gWinLocRootT to getAt(the rect of window gActiveWin, 2)
  21.     set gWinLocCounter to 1
  22.   end if
  23. end
  24.  
  25. on mSetbasicWinKeys me, pWindow
  26.   tell pWindow
  27.     set the keyDownScript to "mWinKeyClicked(oWinKey)"
  28.   end tell
  29. end
  30.  
  31. on mWinKeyClicked me
  32.   global gComputerModel, gInputField
  33.   set vKey to the key
  34.   set vwhat to charToNum(vKey)
  35.   if the commandDown and (vKey = "W") then
  36.     closeWindow()
  37.     exit
  38.   end if
  39.   if gHoldSearchInfo then
  40.     if vwhat = 8 then
  41.       if the shiftDown then
  42.         tell the stage
  43.           put EMPTY into field gInputField
  44.         end tell
  45.       else
  46.         tell the stage
  47.           set t to the selStart
  48.         end tell
  49.         tell the stage
  50.           delete char the selStart of field gInputField
  51.         end tell
  52.         if t > 0 then
  53.           tell the stage
  54.             set the selStart to t - 1
  55.           end tell
  56.         end if
  57.         tell the stage
  58.           set the selEnd to the selStart
  59.         end tell
  60.       end if
  61.       tell the stage
  62.         set x to the number of chars in field gInputField
  63.       end tell
  64.       if x > 1 then
  65.         set gTimeRunningF to 0
  66.         tell the stage
  67.           hKeyTimeMgr()
  68.         end tell
  69.       else
  70.         tell the stage
  71.           set the timeoutScript to EMPTY
  72.         end tell
  73.       end if
  74.       dontPassEvent()
  75.     else
  76.       if (vwhat = 28) and not (the commandDown) then
  77.         tell the stage
  78.           set y to the selStart
  79.         end tell
  80.         if y > 0 then
  81.           tell the stage
  82.             set the selStart to the selStart - 1
  83.           end tell
  84.         end if
  85.         tell the stage
  86.           set the selEnd to the selStart
  87.         end tell
  88.       else
  89.         if (vwhat = 29) and not (the commandDown) then
  90.           tell the stage
  91.             set y to the selEnd
  92.           end tell
  93.           tell the stage
  94.             set z to the number of chars in field gInputField
  95.           end tell
  96.           if y < z then
  97.             tell the stage
  98.               set the selEnd to the selEnd + 1
  99.             end tell
  100.           end if
  101.           tell the stage
  102.             set the selStart to the selEnd
  103.           end tell
  104.         else
  105.           tell the stage
  106.             hKeyCheck(the key)
  107.           end tell
  108.         end if
  109.       end if
  110.       dontPassEvent()
  111.     end if
  112.   else
  113.     tell the stage
  114.       hKeyCheck(the key)
  115.     end tell
  116.     dontPassEvent()
  117.   end if
  118. end
  119.