Your code gives the error: Too many input arguments
I actually came up with the following code which does move the cursor automatically to the next editbox after entering 5 characters:
function edit1_KeyPressFcn(hObject, eventdata, handles)
if strcmp(eventdata.Key, 'backspace');
handles.edit1 = handles.edit1(1:end-1)
handles.edit1 = [handles.edit1 eventdata.Character]
stred1 = char(handles.edit1)
pure_stred1 = stred1(isstrprop(stred1,'alphanum'))
leng_str1 = length(pure_stred1)
uicontrol(handles.edit2) % move the cursor to the next editbox
but it has three problems:
- If I copy and past (Ctrl+v) input of multiple characters, it understands it as one character.
- If I select the whole previously entered input and click 'backspace' or 'space' it also understands it as one-character input.
- If I delete only one character by using the button 'delete', it understands it as deletion of whole inputs so it sets the length to zero.
Any idea on how to make the code understand the actions as they are meant to?