Cursor position in the edit window using GUIDE
11 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!