Re: [gtk-list] Need hidden password entry




> I need to have users type passwords _hidden_ in a gtk_entry text field. It
> should either be "white text on white background" or asterisks or similar.
> Anyone got a hint for me how to e.g. set text color to bg color?

gtk_entry_set_visible (entry, FALSE), should do almost what you
want. One problem is that it doesn't disable selecting the
text and pasting it somewhere else, so at the very least you
should make sure either to destroy the entry or clear the text
in it once the user has input the text.

(If you wanted to implement the asterisks, the approach would be to
add a key_press handler that called gtk_signal_emit_stop_by_name
(GTK_OBJECT (entry), "key_press_event"). Handle the key presses
yourself, then append asterisks to the entry field as appropriate.

Some people consider echoing asterisks a bad idea since it allows
shoulder-surfers to count the password length.)

Regards,
                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]