change focus in app desinger

I have a edit box that requires user input values.
Is there a way to put the cursor in the editbox without click the box? Instead I want the user to be able to press enter key to activate the editbox and input their value.

11 件のコメント

Adam Danz
Adam Danz 2019 年 9 月 19 日
編集済み: Adam Danz 2020 年 4 月 8 日
From within your GUI code you can simply put focus on your editbox with the line below but that is not activated by pressing the enter key.
uicontrol(handles.editbox);
JIAYING WU
JIAYING WU 2019 年 9 月 19 日
I'm using app designer. uicontrol is not an option.
Adam Danz
Adam Danz 2019 年 9 月 19 日
編集済み: Adam Danz 2019 年 9 月 19 日
good to know...
I'm not sure if there is an equivalent in app designer. See:
JIAYING WU
JIAYING WU 2019 年 9 月 19 日
lol. I've saw that before. Just want to see if it is solved after two years....
Ned
Ned 2019 年 9 月 20 日
I recently needed to find information about how app designer handles focus, and I couldn't find any. According to their documentation, event.Source is supposed to give you the "Object that has focus when the key is pressed", but it always returns the UIFigure. There's an undocumented 'CurrentObject' property for uifigure, but that doesn't seem functional atm.
Joris Brouwer
Joris Brouwer 2020 年 4 月 8 日
Same issue here for a couple of years now, this really needs to be resolved. I am reluctant to change back to GUIDE due to the improvements in other areas. But now I have to adapt the user experience in a slightly awkward way to get to a minimum of interaction and have it look like it has focus in the correct field. Just tried R2020a and no luck.
Adam Danz
Adam Danz 2020 年 4 月 8 日
@Joris, FYI, the GUIDE environment will be removed in a future release of Matlab. Existing GUIDE GUIs will still be functional but not editable.
Moritz Scherrmann
Moritz Scherrmann 2021 年 2 月 5 日
Is there any progress? I consider moving to a python equivalent...
Mario Malic
Mario Malic 2021 年 2 月 5 日
You can use 'tab' to change focuses between components, it'll cycle through component list in component browser.
I am not sure if it'll work on user created EditFields.
works math
works math 2022 年 5 月 2 日
Is there any new progress on this issue ? Date:2022.5.2
Adam Danz
Adam Danz 2022 年 5 月 2 日
@works math, yes! Just added an answer to update this thread.

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

回答 (1 件)

Adam Danz
Adam Danz 2022 年 5 月 2 日

0 投票

> Is there a way to put the cursor in the editbox without click the box
Yes, as of MATLAB R2022a.
See the focus function which is also reviewed in this Community Highlight.
Also see a review of the new ways to control tab order in this Community Highlight.

カテゴリ

ヘルプ センター および File ExchangeDevelop Apps Programmatically についてさらに検索

質問済み:

2019 年 9 月 19 日

コメント済み:

2022 年 5 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by