matlab中gui设计时如何隐藏密码,使密码显示为星号
2个回答
展开全部
设置该控件的KeypressFcn属性,通过链接的回调函数,使得每输入一个字符后马上用*号代替。
下面是一段回调函数的代码,可以参照一下
function PasswordKeyPress(hObject,event)
hAuth = getappdata(0,'hAuth');
password = get(hAuth.ePassword,'UserData');
switch event.Key
case 'backspace'
password = password(1:end-1);
case 'return'
uiresume;
return;
otherwise
password = [password event.Character];
end
set(hAuth.ePassword,'UserData',password)
展开全部
function PasswordKeyPress(hObject,event)
hAuth = getappdata(0,'hAuth');
password = get(hAuth.ePassword,'UserData');
switch event.Key
case 'backspace'
password = password(1:end-1);
case 'return'
uiresume;
return;
otherwise
password = [password event.Character];
end
set(hAuth.ePassword,'UserData',password)
hAuth = getappdata(0,'hAuth');
password = get(hAuth.ePassword,'UserData');
switch event.Key
case 'backspace'
password = password(1:end-1);
case 'return'
uiresume;
return;
otherwise
password = [password event.Character];
end
set(hAuth.ePassword,'UserData',password)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询