Easy question for editbox?

Hello,
I am using edit box as an input window. When user click enter button callback of the edit box runs and takes the input. And in order to change the text of edit box I need to select the editbox again. Is there code that I can add and of callback, it selects edit box instead of me.

답변 (1개)

Image Analyst
Image Analyst 2013년 12월 14일

0 개 추천

You don't need to "select" it. You just use the set() function to send a string to it.
set(handles.edit1, 'String', yourString);

댓글 수: 4

Volkan Kandemir
Volkan Kandemir 2013년 12월 14일
편집: Image Analyst 2013년 12월 14일
Users will type the string into the editbox. However, when he press the enter key, user need to select edit box again to type the second input. Therefore, I want to write a code that I can activate editbox programmatically such that users don't need to click on it with mouse.
Image Analyst
Image Analyst 2013년 12월 14일
Put whatever you want to do into the keypress event. Check if the key is enter and if it is, do your stuff.
Volkan Kandemir
Volkan Kandemir 2013년 12월 15일
but I am asking what is my stuff to select this edit box via code?
Image Analyst
Image Analyst 2013년 12월 15일
What do you mean by "select"? Do you mean to highlight the text that is in there so that if the user types a character the whole contents are replaced by what he typed? Or do you mean that it just has focus? If it's the former you'll have to look to some java code. Try http://undocumentedmatlab.com/blog/customizing-editboxes/ - that will show you how to do it.

이 질문은 마감되었습니다.

태그

질문:

2013년 12월 14일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by