Alert Dialogs with MIAW

Those pesky MIAW's - Movie In A Window...

for vague instructions see "Using Lingo", chapter 9 (pp 205-229)

The modal property (true), tells the window not to respond to events outside the window (eg a mouseClick on the desktop). Alert dialog boxes are modal, while the document windows of most applications are not.

Here is some example script I made up - it works for me, but make sure you have some way of getting out of the alert movie as the MIAW is modal. You will need to make up a movie called "alert.d" and put it in the same folder as the one which contains the following script. Give it width of 368 and height of 133 in the preferences dialog box. Put a button in there which has...

on mouseUp  -- I haven't checked this though
  global alertWindow
  if objectP(alertWindow) then
    tell the stage to disposeWindow  -- need a disposeWindow handler in the main movie
  end if
end
in main movie...
on makeAlert
  global alertWindow
  set centreH to (the stageRight - the stageLeft)/2 + the stageLeft
  set centreV to (the stageBottom - the stageTop)/2 + the stageTop
  set alertW to 368  -- width of alert window
  set alertH to 133  -- height of alert window (use stage preferences of movie you're calling)
  set alertLeft to centreH - alertW/2
  set alertTop to centreV - alertH/2
  set alertRect to rect(alertLeft,alertTop,alertLeft + alertW,alertTop + alertH)
  set alertDrawRect to rect(0,0,alertW,alertH)
  set alertWindow to window "alert.d"     -- This uses the file "alert.d" in the current directory
  set the windowType of alertWindow to 1
  set the modal of alertWindow to true    -- this is really modal, so when you open the window, if it doesn't include some way (within the "alert.d" movie) of getting out, you're stuck!
  set the rect of alertWindow to alertRect
  set the drawRect of alertWindow to alertDrawRect  -- may not need this
  set the visible of the stage to false
  open alertWindow
end
 
on disposeWindow  -- I haven't checked this handler
  global alertWindow
  if objectP(alertWindow) then forget alertWindow
  set the visible of the stage to true
end
When you get "alert.d" made, just type makeAlert into the message window of your main movie, and it should work - save first though, 'cause the modal property may make you have to force quit from Director Matt Craig
Flinders Medical Centre
South Australia
Email mnmac@flinders.edu.au