Cursor position in the edit window using GUIDE
11 次查看(过去 30 天)
显示 更早的评论
Hello, I am using KeyPressFunction for my edit text uicontrol to replace input characters with the string of "*". However, every time I set the string the cursor always goes at the beginning of the string. Is there any way to send it at the end? I know there is a "\r" special character, is there any special character that does the opposite? I have found some solutions which use actxcontrol, but I am trying to avoid that.
Here is the code snippet:
if true
function edit_pass_KeyPressFcn(hObject, eventdata, handles)
acceptable_characters=char([65:90 97:122]);
if strfind(acceptable_characters,eventdata.Character)
handles.password=[handles.password eventdata.Character];
dummy_str=char(42*ones(1,length(handles.password)));
set(handles.edit_pass,'String', dummy_str);
end
guidata(hObject,handles);
end
Thank you!
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!