App Designer auto go to one edit-field component

8 ビュー (過去 30 日間)
Leo Zhai
Leo Zhai 2021 年 9 月 27 日
回答済み: Sivani Pentapati 2021 年 11 月 7 日
Hi,
I open my app (developed by AppDesigner), I want it startup and auto go to (activate) one edit-field compoenent, no need to click it, so I could immediately type something.
Thanks!

回答 (1 件)

Sivani Pentapati
Sivani Pentapati 2021 年 11 月 7 日
Please refer to the below answer for a temporary workaround
In order to make it working with respect to R2021b, change the startup function to the below code, by adding a pause between the declaration of the Robot and key press function call. Adding another pause between the key press and key release would let you type into the field during the corresponding interval.
import java.awt.*;
import java.awt.event.*;
rob = Robot;
pause(1)
rob.keyPress(KeyEvent.VK_TAB)
pause(10) %duration for which the edit field is enabled
rob.keyRelease(KeyEvent.VK_TAB)
rob.keyPress(KeyEvent.VK_TAB)
rob.keyRelease(KeyEvent.VK_TAB)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by