フィルターのクリア

Help me: edit box

1 回表示 (過去 30 日間)
Ju
Ju 2012 年 3 月 6 日
hi all. Please help me with this. I have a variable CHARS=0, and i have an edit box. i want to make: if i type a letter in that edit box, CHARS will increase 1, and so on.. [*same as SMS*] how can we do this in Matlab? Thanks.
Note: i have used the keyPress_Function, but it doesnt work.
  3 件のコメント
Ju
Ju 2012 年 3 月 10 日
i mean, in figure.
it doesn't work means that the variable only increase once, if i type the second letter, the values doesn't increase anymore..
is it possible to control the maximum character of edit box in matlab?
thanks before.
Jan
Jan 2012 年 3 月 11 日
Please post the code such that we have a chance to find the error.

サインインしてコメントする。

回答 (2 件)

Aldin
Aldin 2012 年 3 月 11 日
Do you mean: you have edit box , and button when you click on button the CHAR variable must be increased??
  1 件のコメント
Image Analyst
Image Analyst 2012 年 3 月 11 日
No, he wants it to increment an integer variable every time he hits a key while the focus is in that particular edit box.

サインインしてコメントする。


Walter Roberson
Walter Roberson 2012 年 3 月 11 日
If you are setting your edit box to correspond to the length of the String of the string you get() from the control, then you are going to have problems: for reasons unknown, the keypress function callbacks are not able to get() the assembled string from the String property of an uicontrol() of style 'edit'
If you want to use the keypress callbacks to do per-key-press work on a uicontrol of style 'edit' then the keypress function callback will need to store the entered characters somewhere else (e.g., in the UserData property of the control), and then upon detecting that the user pressed enter, set() the String property of the control to the remembered string. Note that it will also be necessary to recognize and react appropriately to deletions.

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by