home *** CD-ROM | disk | FTP | other *** search
- on setupSDialogue theMessageText, theWindowHeight, theMode, theButtTextList
- global gSDialogue
- if voidp(theButtTextList) then
- set theButtTextList to ["Yes", "No"]
- end if
- set buttOne to getAt(theButtTextList, 1)
- set buttTwo to getAt(theButtTextList, 2)
- set boxWidth to 318
- set buttonWidth to 113
- set SpaceHeight to 10
- set ButtonHeight to 35
- set labelHeight to theWindowHeight - (ButtonHeight + (3 * SpaceHeight))
- set labelV to SpaceHeight
- set buttonV to (SpaceHeight * 2) + labelHeight
- set alertH to (boxWidth - buttonWidth) / 2
- set gSDialogue to new(xtra("MUI"))
- if objectp(gSDialogue) then
- set SDialogueWinPropList to GetWindowPropList(gSDialogue)
- set the name of SDialogueWinPropList to "Špión - Strašidelný dùm"
- set the callback of SDialogueWinPropList to "SDialogueCallBack"
- set the mode of SDialogueWinPropList to #pixel
- set the closeBox of SDialogueWinPropList to 0
- set the modal of SDialogueWinPropList to 1
- set the xPosition of SDialogueWinPropList to -1
- set the yPosition of SDialogueWinPropList to -1
- set the width of SDialogueWinPropList to boxWidth
- set the height of SDialogueWinPropList to theWindowHeight
- set myWindowItemList to []
- set tempItemProps to GetItemPropList(gSDialogue)
- set the type of tempItemProps to #WindowBegin
- append(myWindowItemList, duplicate(tempItemProps))
- set tempItemProps to GetItemPropList(gSDialogue)
- set the type of tempItemProps to #label
- set the value of tempItemProps to theMessageText
- setProp(tempItemProps, #attributes, [#justification: #left, #textStyle: [#plain]])
- set the locH of tempItemProps to 12
- set the locV of tempItemProps to labelV
- set the width of tempItemProps to 289
- set the height of tempItemProps to labelHeight
- append(myWindowItemList, duplicate(tempItemProps))
- case theMode of
- 0:
- set tempItemProps to GetItemPropList(gSDialogue)
- set the type of tempItemProps to #pushButton
- set the title of tempItemProps to "OK"
- set the locH of tempItemProps to alertH
- set the locV of tempItemProps to buttonV
- set the width of tempItemProps to buttonWidth
- set the height of tempItemProps to ButtonHeight
- append(myWindowItemList, duplicate(tempItemProps))
- 1:
- set tempItemProps to GetItemPropList(gSDialogue)
- set the type of tempItemProps to #pushButton
- set the title of tempItemProps to buttOne
- set the locH of tempItemProps to 43
- set the locV of tempItemProps to buttonV
- set the width of tempItemProps to buttonWidth
- set the height of tempItemProps to ButtonHeight
- append(myWindowItemList, duplicate(tempItemProps))
- set tempItemProps to GetItemPropList(gSDialogue)
- set the type of tempItemProps to #pushButton
- set the title of tempItemProps to buttTwo
- set the locH of tempItemProps to 165
- set the locV of tempItemProps to buttonV
- set the width of tempItemProps to buttonWidth
- set the height of tempItemProps to ButtonHeight
- append(myWindowItemList, duplicate(tempItemProps))
- end case
- set tempItemProps to GetItemPropList(gSDialogue)
- set the type of tempItemProps to #WindowEnd
- append(myWindowItemList, duplicate(tempItemProps))
- Initialize(gSDialogue, [#windowPropList: SDialogueWinPropList, #windowItemList: myWindowItemList])
- else
- end if
- end
-
- on SDialogueCallBack event, eventData, itemPropList
- global gDiagResult
- if symbolp(event) then
- case event of
- #itemClicked:
- put "the button is" && eventData
- case eventData of
- 3:
- set gDiagResult to 1
- stopSDialogue()
- 4:
- set gDiagResult to 2
- stopSDialogue()
- otherwise:
- stopSDialogue()
- end case
- end case
- end if
- end
-
- on runSDialogue
- global gSDialogue, gDiagResult
- if objectp(gSDialogue) then
- Run(gSDialogue)
- end if
- put gDiagResult
- end
-
- on stopSDialogue
- global gSDialogue
- if objectp(gSDialogue) then
- stop(gSDialogue, 0)
- end if
- end
-