Add validation functions to (Numeric)EditFields with consistent look-and-feel

조회 수: 5 (최근 30일)
Carina Schwab
Carina Schwab 2022년 10월 3일
편집: Carina Schwab 2022년 10월 10일
NumericEditFields contain functionality to validate/restrict user input to numbers or specific ranges. What is best practice to add additional validations and use validations for EditFields (text)?
  • Is there the possibility to add validation functions via function handle?
  • If I validate the input in the ValueChanged function: is there a documented function that I can use to achieve the same error-highlighting style in the GUI that Matlab uses for the standard validation functions (a tooltip in the same style and red field border)?
  • Is the same approach usable for EditFields (text)?
  • How do I achieve a consistent look-and-feel for the user that alerts them to input errors?

답변 (1개)

Navya Singam
Navya Singam 2022년 10월 7일
Hi Carina,
You can refer the Code Response to Changed Edit Field Text section in the following documentation for more information on how to use the callbacks for validation on Edit field (both numeric and text) in App Designer.
  댓글 수: 1
Carina Schwab
Carina Schwab 2022년 10월 10일
편집: Carina Schwab 2022년 10월 10일
Hello Navya,
thank you for the link. But as far as I can see this section of the documentation shows how to update a label when the value in the edit field changed. What I'm looking for is the exact visual representation that the built-in numeric edit field validation produces in order to achieve a consistent look-and-feel in the app.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by