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
Space C
Base64 Xtra
Dave Client
Get Least Common Denominator
Image Xport
Faux Marquee Tool
Add a unique property to a property list
Stop MPEG with MCI commands
Direct Media Simple Control
Space Invaders
 

 

 

Behavior sets custom cursors

Added on 6/30/1999

 

Compatibilities:
D6_5 D7 D8 Mac PC Script

This item has not yet been rated

Author: LorenMork

Sets the cursor

on setCursor parameters
  
  -------------------------------------------------------------
  -------------------------------------------------------------
  
  -- Loren Mork, Seattle, Wa, Lmork@aol.com
  -- v 1.0   1998
  
  -- SetCursor is a handler that sets the cursor of sprite for
  -- any number of sprites or sprite ranges - it uses lists
  -- and integers, seperated by commas, to designate the sprites.
  -- The first value or list must contain the cursor you wish to use.
  -- Input the first parameter / argument either as the
  -- single number of a Director internal cursor, such as 260
  -- (for the hand icon), or as a list of two numbers representing
  -- membernums of a one bit image and it's mask  [ 16, 17],
  -- ie: a custom cursor (see below)  
  
  -- Examples:
  
  -- setCusor 260      
  -- shows where to place a single number -260- for
  -- the cursor number (in this case the internal hand cursor).
  -- NOTE:there must also be designated sprites to affect
  -- or nothing will happen.(see below)
  
  -- see bottom of this handler for a listing of internal cursors
  
  -- setCursor [16,17]
  -- shows where and how to place
  -- the list of members used for a custom cursor
  -- NOTE:there must also be designated sprites to affect
  -- or nothing will happen.(see below)
  
  -- After the cursor has been designated,  put in the sprites
  -- you wish the cursor to affect
  -- as either single integers seperated by commas, or
  -- by lists containg two numbers
  -- ie the bottom  of the sprite range you want selected,
  -- and the top of that sprite range
  -- or by a combination of both
  -- there are no restrictions on the number of parameters / arguments.
  
  -- setCursor 260, 3, 9, [23,35], 67, 90, [106,112]
  -- the line above sets,to cursor 260 (the internal hand cursor), sprites 3,9,23-35,67,90,106-112
  
  -- setCursor [16,17], [1,25], 36,[42,80],[105,116], 120
  -- the line above sets,to a custom cursor using members [16,17],
  -- sprites  1- 25, 36, 42-80, 105-116,120
  
  -- Note that after setting the inital cursor number, you can list in as many sprites
  -- or sprite ranges as you wish-
  -- there is no preformatted restrictions on these parameters / arguments
  -- but the first parameter / argument always has to designate the cursor

  -------------------------------------------------------------
  -------------------------------------------------------------
  
  -- get the number of parameters / arguments that come after the handler name
  -- and put in a variable
  
  set tParamCount = the paramCount

  -- defensive check to see if less than 2 parameters  
  
  if tParamcount < 2 then exit  
  -- the first parameter is always the cursor.
  -- it can be passed as a list, ie [spritenum,spritenum] or [34,35]
  -- or passed as a number contained on the tInternalCursorList
  
  set tCursor   =  param(1)
  -- list of internally available cursors
  
  set tInternalCursorList = [0, 200,254,256,257,258,259,260,272,280,281,282,283,284,285,286,290,291,292,293,300,301,302,303,304]
  
  -- defensive check to see if the first parameter is a list that has more than 2 numbers in it
  -- if it does then  exit
  
  if listp(tCursor) = 1 then
    if count(tCursor) > 2 then exit
  end if

  -- defensive check to see if the first parameter is a list
  -- if it is not then check to see if it is on tCursorList
  -- if not on either then exit - it is not a valid cursor number
  -- after this filter, the cursor of any sprite can be set to tCursor.
  -- tCursor is ready-to-go.
  -- Note - other cursor numbers can be added to tInternalList if neccesary
  
  if listp (tCursor) = 0 then
    if getPos (tInternalCursorList, tCursor) = 0 then exit
  end if
  
  -- start the repeat loop at the second parameter in the list
  -- because number one is always the cursor as a list or integer
  -- loop through all other parameters
  
  repeat with currentparam = 2 to tParamCount
    
    put param(currentparam) into tTempParam
    
    
    if not listp(tTempParam) then
      -- defensive check
      -- if it is not a list it must be a single sprite number
      -- if it is zero, then ignore it and get next number
      if tTempParam = 0 then next repeat
      
      set the cursor of sprite tTempParam = tCursor
      next repeat  
      -- get the next value from the list
      
    else
      -- must be a list
      -- get the two numbers off of the list
      
      set tStartSprite =  getat (tTempParam , 1)
      set tEndSprite   =  getat (tTempParam , 2)
    end if
    
    if tStartSprite > tEndSprite then
      -- defensive check to see if the largest number came first
      
      repeat with tSprite = tStartSprite down to tEndSprite
        -- must be in wrong order, so adjust
        set the cursor of sprite tSprite = tCursor
      end repeat
      
    else
      -- correct order
      repeat with tSprite = tStartSprite  to tEndSprite
        set the cursor of sprite tSprite = tCursor
      end repeat
      
    end if
  end repeat
  
  -------------------------------------------------------------
  -------------------------------------------------------------
  

  -- custom cursor list
  -- 0   - reset to normal- system default
  -- -1  - arrow cursor
  -- 1      - I-beam cursor
  -- 2      - crosshair cursor
  -- 3      - crossbar cursor
  -- 4      - watch cursor
  -- 200 - blank
  -- 254 - help
  -- 256 - pencil
  -- 257 - erase
  -- 258 - select
  -- 259 - bucket
  -- 260 - hand
  -- 272 - lasso
  -- 280 - finger
  -- 281 - dropper
  -- 282 - mouse up
  -- 283 - mouse down
  -- 284 - vertical stretcher
  -- 285 - horizontal stretcher
  -- 286 - corner stretcher
  -- 290 - closed hand
  -- 291 - no-drop closed hand
  -- 292 - copy closed hand
  -- 293 - mac inverse arrow
  -- 300 - smear smotth brush
  -- 301 - air brush
  -- 302 - zoom in
  -- 303 - zoom out
  -- 304 - zoom cancel
    
  -------------------------------------------------------------
  
end setCursor

 


Contact

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

Send e-mail