home *** CD-ROM | disk | FTP | other *** search
/ Spy: Haunted House / spion.iso / data1.cab / Program_Executable_Files / _Spooky.exe / _Spooky.dxr / 00003_dialogue box.ls < prev    next >
Encoding:
Text File  |  2002-10-29  |  4.0 KB  |  111 lines

  1. on setupSDialogue theMessageText, theWindowHeight, theMode, theButtTextList
  2.   global gSDialogue
  3.   if voidp(theButtTextList) then
  4.     set theButtTextList to ["Yes", "No"]
  5.   end if
  6.   set buttOne to getAt(theButtTextList, 1)
  7.   set buttTwo to getAt(theButtTextList, 2)
  8.   set boxWidth to 318
  9.   set buttonWidth to 113
  10.   set SpaceHeight to 10
  11.   set ButtonHeight to 35
  12.   set labelHeight to theWindowHeight - (ButtonHeight + (3 * SpaceHeight))
  13.   set labelV to SpaceHeight
  14.   set buttonV to (SpaceHeight * 2) + labelHeight
  15.   set alertH to (boxWidth - buttonWidth) / 2
  16.   set gSDialogue to new(xtra("MUI"))
  17.   if objectp(gSDialogue) then
  18.     set SDialogueWinPropList to GetWindowPropList(gSDialogue)
  19.     set the name of SDialogueWinPropList to "┼ápi├│n - Stra┼íideln├╜ d├╣m"
  20.     set the callback of SDialogueWinPropList to "SDialogueCallBack"
  21.     set the mode of SDialogueWinPropList to #pixel
  22.     set the closeBox of SDialogueWinPropList to 0
  23.     set the modal of SDialogueWinPropList to 1
  24.     set the xPosition of SDialogueWinPropList to -1
  25.     set the yPosition of SDialogueWinPropList to -1
  26.     set the width of SDialogueWinPropList to boxWidth
  27.     set the height of SDialogueWinPropList to theWindowHeight
  28.     set myWindowItemList to []
  29.     set tempItemProps to GetItemPropList(gSDialogue)
  30.     set the type of tempItemProps to #WindowBegin
  31.     append(myWindowItemList, duplicate(tempItemProps))
  32.     set tempItemProps to GetItemPropList(gSDialogue)
  33.     set the type of tempItemProps to #label
  34.     set the value of tempItemProps to theMessageText
  35.     setProp(tempItemProps, #attributes, [#justification: #left, #textStyle: [#plain]])
  36.     set the locH of tempItemProps to 12
  37.     set the locV of tempItemProps to labelV
  38.     set the width of tempItemProps to 289
  39.     set the height of tempItemProps to labelHeight
  40.     append(myWindowItemList, duplicate(tempItemProps))
  41.     case theMode of
  42.       0:
  43.         set tempItemProps to GetItemPropList(gSDialogue)
  44.         set the type of tempItemProps to #pushButton
  45.         set the title of tempItemProps to "OK"
  46.         set the locH of tempItemProps to alertH
  47.         set the locV of tempItemProps to buttonV
  48.         set the width of tempItemProps to buttonWidth
  49.         set the height of tempItemProps to ButtonHeight
  50.         append(myWindowItemList, duplicate(tempItemProps))
  51.       1:
  52.         set tempItemProps to GetItemPropList(gSDialogue)
  53.         set the type of tempItemProps to #pushButton
  54.         set the title of tempItemProps to buttOne
  55.         set the locH of tempItemProps to 43
  56.         set the locV of tempItemProps to buttonV
  57.         set the width of tempItemProps to buttonWidth
  58.         set the height of tempItemProps to ButtonHeight
  59.         append(myWindowItemList, duplicate(tempItemProps))
  60.         set tempItemProps to GetItemPropList(gSDialogue)
  61.         set the type of tempItemProps to #pushButton
  62.         set the title of tempItemProps to buttTwo
  63.         set the locH of tempItemProps to 165
  64.         set the locV of tempItemProps to buttonV
  65.         set the width of tempItemProps to buttonWidth
  66.         set the height of tempItemProps to ButtonHeight
  67.         append(myWindowItemList, duplicate(tempItemProps))
  68.     end case
  69.     set tempItemProps to GetItemPropList(gSDialogue)
  70.     set the type of tempItemProps to #WindowEnd
  71.     append(myWindowItemList, duplicate(tempItemProps))
  72.     Initialize(gSDialogue, [#windowPropList: SDialogueWinPropList, #windowItemList: myWindowItemList])
  73.   else
  74.   end if
  75. end
  76.  
  77. on SDialogueCallBack event, eventData, itemPropList
  78.   global gDiagResult
  79.   if symbolp(event) then
  80.     case event of
  81.       #itemClicked:
  82.         put "the button is" && eventData
  83.         case eventData of
  84.           3:
  85.             set gDiagResult to 1
  86.             stopSDialogue()
  87.           4:
  88.             set gDiagResult to 2
  89.             stopSDialogue()
  90.           otherwise:
  91.             stopSDialogue()
  92.         end case
  93.     end case
  94.   end if
  95. end
  96.  
  97. on runSDialogue
  98.   global gSDialogue, gDiagResult
  99.   if objectp(gSDialogue) then
  100.     Run(gSDialogue)
  101.   end if
  102.   put gDiagResult
  103. end
  104.  
  105. on stopSDialogue
  106.   global gSDialogue
  107.   if objectp(gSDialogue) then
  108.     stop(gSDialogue, 0)
  109.   end if
  110. end
  111.