Cursor position in the edit window using GUIDE

조회 수: 11 (최근 30일)
Aleksey
Aleksey 2013년 4월 8일
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개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by