Effacer les filtres
Effacer les filtres

I want to get currentlytyped character from editfiled becuase I want to change every current character into password character (*). Kindly help me Thanks

3 vues (au cours des 30 derniers jours)
I am using this code but I cannot get current characters.
function [] = edit2_keypressfcn(varargin)
password = get(edit2,'userdata');
key = get(fig,'currentkey');
switch key
case 'backspace'
password = password(1:end-1);
SizePass = size(password);
if SizePass(2) > 0
asterisk(1,1:SizePass(2)) = '•';
set(edit2,'String',asterisk)
else
set(edit2,'String','')
end
set(edit2,'Userdata',password)
case 'escape'
case 'insert'
case 'delete'
case 'home'
case 'pageup'
case 'pagedown'
case 'end'
case 'rightarrow'
case 'downarrow'
case 'leftarrow'
case 'uparrow'
case 'shift'
case 'return'
pus1_callback(varargin);
case 'alt'
case 'control'
case 'windows'
otherwise
password = [password get(fig,'currentcharacter')];
SizePass = size(password);
if SizePass(2) > 0
asterisk(1:SizePass(2)) = '*';
set(edit2,'string',asterisk)
else
set(edit2,'String','');
end
set(edit2,'Userdata',password) ;
end
end
  2 commentaires
Rik
Rik le 12 Nov 2018
I don't believe this is possible. What you can do is making a text field that looks like an edit field, and then use this code.
BTW, this code will probably break if the users presses backspace more than there are chars in the current stored password.
Ahmer Shahid
Ahmer Shahid le 13 Nov 2018
Yes there are many problems in this that I cannot handle. Is there any other solution or some builtin functions for hiding my password. Kindly share if possible thanks.

Connectez-vous pour commenter.

Réponse acceptée

Jan
Jan le 13 Nov 2018
You find many many many solutions for password dialogs in the FileExchange. Simply search for the keyword "password":

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by