PasswordField

From Unify Community Wiki
Revision as of 21:55, 10 October 2007 by StarManta (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

by StarManta

Usage

Insert the function into any .js file. You can then call this as you would call GUILayout.Textfield. TODO: allow for input of GUIStyles. For now, just hardcode them into the TextFeld call in the function.


<javascript> static function PasswordField(password : String, maskChar : String) { if (Event.current.type == EventType.repaint || Event.current.type == EventType.mouseDown) { strPasswordMask = ""; for (i = 0; i <password.Length; i++) { strPasswordMask += maskChar; } } else { strPasswordMask = password; } GUI.changed = false; strPasswordMask = GUILayout.TextField(strPasswordMask, GUILayout.Width(150)); if (GUI.changed) { password = strPasswordMask; } } </javascript>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox