フィルターのクリア

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

3 ビュー (過去 30 日間)
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 件のコメント
Rik
Rik 2018 年 11 月 12 日
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 2018 年 11 月 13 日
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.

サインインしてコメントする。

採用された回答

Jan
Jan 2018 年 11 月 13 日
You find many many many solutions for password dialogs in the FileExchange. Simply search for the keyword "password":

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by