------ Get Behavior Description List ------
on getPropertyDescriptionList me
set description = [:]
if the currentspritenum = 0 then exit
addProp description, #permittedchars, [#comment: "Enter the permitted Charactes of the Field :" ,#format:#String, \
#range:["Only Aplhabets","Only Numbers","Alphanumeric","Only Special Characters","Custom Characters","Allow all"],#default:"Alphanumeric"]
addProp description, #customcharacters, [#comment: "Enter the Custom Characters here(use this only if you select custom characters from above) :" ,#format:#String,#default:"Enter Custom Characters here"]
return description
end getPropertyDescriptionList
------ Get Behavior Description List ------
-- Get Behavior description --
on getBehaviorDescription me
return \
"Force Characters" & RETURN & RETURN & \
"* Allows to enter only permitted Characters"
end getBehaviorDescription
-- Get Behavior description --
--- Available for only field members on the stage ----
on isOKToAttach (me, aSpriteType, aSpriteNum)
case aSpriteType of
#graphic:
return getPos([#field], sprite(aSpriteNum).member.type) <> 0
#script:
return FALSE
end case
end isOKToAttach
--- Available for only field members on the stage ----
--- intialize field ---
on beginSprite me
set allowall=true
TheMember = member (sprite (spriteNum).member)
set the editable of sprite spriteNum to TRUE
put "" into field TheMember
end
--- intialize field ---
-----on keydown event---
on keyDown
put the key into keyentered
case permittedchars of
"Only Aplhabets":set charssupported="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
"Only Numbers": set charssupported ="0123456789"
"Alphanumeric": set charssupported="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
"Only Special Characters": set charssupported="`~!@#$%^&*()_-+=\|][{}';:/?.>,<" & quote & space
"Custom Characters": set charssupported = customcharacters
"Allow all": set allowall=false
end case
if allowall=true then
if charssupported contains keyentered then
pass
else if keyentered = BACKSPACE then
pass
else
dontPassEvent
end if
else
member(TheMember).text = member(TheMember).text & keyentered
end if
end
-----on keydown event---
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA