Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
PopUp Menu
NetDone() not registering in IE on the Mac
dmm_window
rgb Converter V1.0.1
Fake-3D Motion
bkMixer
Button Factory
QTGrabSprite
Enhancer Xtra
cXtraRTF
MediaMacros Xtras Mall
 

 

 

Behavior Limited Fields

Added on 12/19/1999

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: MediaMacros (website)

This is a simple behavior for text and field members that does the following... Limit a field to certain Characters, Limit a field to a certain NUMBER of characters, Turn the word wrap on/off for the field Enhanced on 9/20/2005 by Dean Utian - fixed so backspace, and arrows work

----

-- Restrict Chars behavior covering backspace/delete/left-right arrows/return/enter/home/end


property spriteNum, maxText, allowedKeys, myWrap, otherHandler



on getPropertyDescriptionList me

  p_list = [:]

  p_list.addProp(#maxText, [#format : #integer, #comment : "Max number of allowed Characters:", #default : 20])

  p_list.addProp(#allowedKeys, [#format : #string, #comment : "Keys to pass to field (Leave blank for all):", #default : "1234567890abcdefghijklmnopqrstuvwxyz"])

  p_list.addProp(#myWrap, [#format : #boolean, #comment : "Allow word wrapping?", #default : 0])

  return p_list

end



on beginSprite me

  sprite(spriteNum).member.wordwrap = myWrap

end



on keyDown me

  case the keyCode of

      --    51,117: -- backspace/delete

      --    115,119: left/right arrow

      --    123,124: -- home/end

      --    36: -- enter/return

    51,117,123,124:

      pass

    36,115,119:

      dontpassevent

    otherwise

      if allowedKeys contains the key and allowedKeys <> "" then

        if sprite(me.spriteNum).member.char.count < maxText then pass

      

      else if allowedKeys = "" then

        pass

      

      else

        dontpassevent        

      

      end if

  end case





on getBehaviorDescription me

  describe = "This is a simple behavior for text and field members that does the following..." & return

  describe = describe & "Limit a field to certain Characters" & return & "Limit a field to a certain NUMBER of characters" & "Turn the word wrap on/off for the field"

end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail