google / gxui

An experimental Go cross platform UI library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FEATURE: PasswordBox (something to set on TextBox?)

sinni800 opened this issue · comments

A way to have a "password character" that will be typed instead of the actual typed character is a pretty standard feature in every UI toolkit ever.

Would this be done by creating a whole new PasswordBox struct with the same kind of methods as TextBox or just setting a flag within the TextBox and having a visible text value plus an actual text value, then adding the wrapper CreatePasswordBox method within the theme that sets the flag?

@knarfrank I presume it would be a property in the TextBox called "PasswordCharacter", a rune which woukd be shown instead of every typed character if it is set not to the unicode null codepoint. I think either the driver or the theme would implement checking for this character (unsure about the logic in the toolkit here) in the drawing routine.