Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
XtrAgent
To activate previous instance and quit
Non-repeating random list
Anatomy of an Alpha Channel
Send OSA Script
Macromedia Director 7 Lingo training CD
ADOxtra for Shockwave Multiuser Server
IPIX
simBrowser1.0
Orbital Master
 

 

 

Behavior WindowShade MIAW

Added on 6/10/1999

 

Compatibilities:
behavior D6_5 Mac PC

This item has not yet been rated

Author: RettCrocker

Use to close MIAW with a button. Use with the Close Box MIAW behavior.

property pMouseDown, pTitleBarSprite, pDiff

on beginSprite me
  set pMouseDown = 0
  set lMovieName = the movieName
  repeat with w in the windowList
    set lPathToWin = the filename of w
    if lPathToWin contains lMovieName then
      set lRectTB = the rect of sprite pTitleBarSprite
      set pDiff = rect(-1 * the left of lRectTB, -1 * the top of lRectTB, the width of the sourceRect of w - the right of lRectTB, the height of the sourceRect of w - the bottom of lRectTB)
      exit repeat
    end if
  end repeat
end

on mouseDown me
  set pMouseDown = 1
end

on mouseUp me
  if pMouseDown then
    set lTest = 1
    if pTitleBarSprite = the spriteNum of me then
      if NOT the doubleClick then
        set lTest = 0
      end if
    end if
    if lTest then
      set lMovieName = the movieName
      repeat with w in the windowList
        set lPathToWin = the filename of w
        if lPathToWin contains lMovieName then
          set lRectOfWin = the rect of w
          set lCurrHeight = the height of lRectOfWin
          set lCurrWidth = the width of lRectOfWin
          if lCurrHeight = (the height of the sourceRect of w) and lCurrWidth = (the width of the sourceRect of w) then
            set lRectOfWin = lRectOfWin - pDiff
            set lDrawRect = the drawRect of w - rect(the left of sprite pTitleBarSprite, the top of sprite pTitleBarSprite, the left of sprite pTitleBarSprite, the top of sprite pTitleBarSprite)
          else
            set lRectOfWin = lRectOfWin + pDiff
            set lDrawRect = rect(0, 0, the width of the sourceRect of w, the height of the sourceRect of w)
          end if
          set the drawRect of w = lDrawRect
          set the rect of w = lRectOfWin
          updatestage
          exit repeat
        end if
      end repeat
    end if
  end if
  set pMouseDown = 0
end

on mouseUpOutside me
  set pMouseDown = 0
end

on externalWindowShadeOpen me
  set lMovieName = the movieName
  repeat with w in the windowList
    set lPathToWin = the filename of w
    if lPathToWin contains lMovieName then
      set lRectOfWin = the rect of w
      set lCurrHeight = the height of lRectOfWin
      set lCurrWidth = the width of lRectOfWin
      if lCurrHeight = (the height of the sourceRect of w) and lCurrWidth = (the width of the sourceRect of w) then
        -- ONLY OPEN
      else
        set lRectOfWin = lRectOfWin + pDiff
        set lDrawRect = rect(0, 0, the width of the sourceRect of w, the height of the sourceRect of w)
      end if
      set the drawRect of w = lDrawRect
      set the rect of w = lRectOfWin
      dontPassEvent
      updatestage
      exit repeat
    end if
  end repeat
  set pMouseDown = 0
end

on getPropertyDescriptionList me
  set description = [:]
  addProp description,#pTitleBarSprite,[#default:1, #format:#integer,#comment:"Which sprite is the title bar:"]
  return description
end

on getBehaviorDescription
  set lText = ""
  put "--======= Windowshade MIAW behavior =======--" & RETURN after lText
  put "This behavior makes a sprite act as if it " after lText
  put "were a window's windowshade box like on the " after lText
  put "macintosh.  In other words, the sprite which " after lText
  put "receives this behavior will shrink the MIAW " after lText
  put "which the sprite is in to the title bar's rect.  " after lText
  put "If the sprite is not inside of a MIAW then " after lText
  put "nothing will happen.  " & RETURN & RETURN after lText
  put "NOTE: This behavior asks for the sprite number " after lText
  put "of the title bar sprite.  The rect of that " after lText
  put "sprite is what the MIAW shrinks to when the " after lText
  put "windowshade is activated.  " & RETURN & RETURN after lText
  put "NOTE: This behavior can be dropped onto " after lText
  put "the title bar sprite itself.  To execute the " after lText
  put "windowshade behavior the user would double " after lText
  put "click on the title bar." & RETURN & RETURN after lText
  put "NOTE: This behavior has one additional external " after lText
  put "method.  This method is called " & QUOTE after lText
  put "externalWindowShadeOpen." & QUOTE & "  This " after lText
  put "method is called by the companion Close Box MIAW " after lText
  put "behavior." & RETURN & RETURN after lText
  put "As always, if you use this behavior I would " after lText
  put "like a mention in your credits.  Enjoy." & RETURN & RETURN after lText
  put "/// © Rett Crocker 1997 \\\" & RETURN after lText
  put "\\\ r3tt@mindspring.com ///" & RETURN after lText
  return lText
end  

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail