Cursor position in the edit window using GUIDE

12 Ansichten (letzte 30 Tage)
Aleksey
Aleksey am 8 Apr. 2013
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!

Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by