home *** CD-ROM | disk | FTP | other *** search
/ Comic Book Maker: The Smurfs / COMIC.iso / mac / data_m / dialog / 00039_initTitleAndNameDialogBhvr.ls < prev    next >
Encoding:
Text File  |  1999-07-07  |  2.3 KB  |  76 lines

  1. property myParams, pTextMaxH, theActiveField
  2. global gDialogPresent, gObj3
  3.  
  4. on beginSprite me
  5.   set adjustVLoc to 10 + the height of the member of sprite 10 + 18
  6.   set bugFix to the left of sprite 2
  7.   set myRect to the rect of sprite 2 + [0, 0, 0, adjustVLoc]
  8.   set the rect of sprite 2 to myRect
  9.   repeat with i in [1, 9, 12, 13, 15, 16]
  10.     set the locV of sprite i to the locV of sprite i + adjustVLoc
  11.   end repeat
  12.   checkBtnLocations(the bottom of myRect)
  13.   set offsetPoint to point(getAt(the rect of the stage, 1) + ((640 - the width of myRect) / 2), getAt(the rect of the stage, 2) + ((480 - the height of myRect) / 2))
  14.   set theRect to myRect + rect(offsetPoint, offsetPoint)
  15.   set the rect of the activeWindow to theRect
  16.   set the modal of the activeWindow to 1
  17.   set the visible of the activeWindow to 1
  18.   set pTextMaxH to 170
  19.   set theActiveField to the number of the member of sprite 12
  20.   set the editableText of sprite 12 to 1
  21.   set the selStart to 0
  22.   set the selEnd to 100
  23.   set the keyDownScript to "processKey(sprite 21)"
  24. end
  25.  
  26. on processKey me
  27.   if (the key = RETURN) or (the key = ENTER) then
  28.     handleDefaultKeyDown(script 1)
  29.   else
  30.     if the key = BACKSPACE then
  31.       puppetSound(1, "deleteKey")
  32.     else
  33.       if the key = TAB then
  34.         if the number of the member of sprite 12 = theActiveField then
  35.           selectField(me, 13, 1)
  36.         else
  37.           selectField(me, 12, 1)
  38.         end if
  39.       else
  40.         if length(the selection) then
  41.           puppetSound(1, "key" & random(3))
  42.         else
  43.           if the locH of charPosToLoc(member theActiveField, length(field theActiveField)) >= pTextMaxH then
  44.             puppetSound(1, "fieldFull")
  45.             stopEvent()
  46.           else
  47.             puppetSound(1, "key" & random(3))
  48.           end if
  49.         end if
  50.       end if
  51.     end if
  52.   end if
  53. end
  54.  
  55. on selectField me, whichSprite, fromTab
  56.   if not fromTab then
  57.     set the selStart to the selEnd
  58.   end if
  59.   if whichSprite = 12 then
  60.     set the editableText of sprite 13 to 0
  61.   else
  62.     set the editableText of sprite 12 to 0
  63.   end if
  64.   set the editableText of sprite whichSprite to 1
  65.   set theActiveField to the number of the member of sprite whichSprite
  66.   go(the frame)
  67.   if fromTab then
  68.     set the selStart to 0
  69.     set the selEnd to 100
  70.   end if
  71. end
  72.  
  73. on getPropertyDescriptionList
  74.   return [#myParams: [#comment: "Params:", #format: #integer, #default: VOID]]
  75. end
  76.