I have a problem that I hope someone can help me solve.
I have created a GUI which contains an editable text style
uiControl which allows the user to type in a password, but
replaces the text being typed into the uiControl with
asterisks. (I borrowed the idea from Jeremy Smith's login.m
file on MATLAB's File Exchange web page.) I use the
uiControl's 'KeyPressFcn' property to capture and replace
the last key pressed by the user as they type in the
password. If the user types a backspace, I act accordingly
by removing the last character in the string of characters
entered thus far.
Here is the problem: if the user uses the mouse to
highlight text in this edit box and then hits backspace,
they expect the highlighted text to be deleted. Is there a
way for me to know when the user has selected (highlighted)
some text in an editable text uiControl?
Here is a snippet of my KeyPressFcn:
password = get(src,'userData');
key = get(fig,'currentKey');
password = password(1:end-1); % delete last char
password = [password get(fig,'currentCharacter')];