App Designer Drop Down "instructional" default value

조회 수: 21(최근 30일)
Matt
Matt 2020년 4월 19일
답변: Ganesh Regoti 2020년 4월 29일
Is there a way to have the drop down component default to some instructional/non-functional value that forces users to select an option? I want something that tells the user to select something but while it is in that "instructional" state, the menu stays in some non-functional state, for lack of a better term. I'm thinking something like making the first option be "Select a month" with the subsequent options being the 12 months. Does MATLAB have a built-in method of handling this or would you have to monitor everything yourself by putting an if/else statement somewhere to check the value to ensure when you go to perform an operation that it is not still "Select a month?" Do you have to modify the "Items," "ItemsData," and/or "Value" arguments in a certain way?

답변(1개)

Ganesh Regoti
Ganesh Regoti 2020년 4월 29일
Hi,
I assume that you are expecting a built-in feature for instructional default value. But as per my knowledge, there is no such feature available as of now. But you can customize it in different ways
Method 1 : During valudation you can check the value of the dropdown element, and if the value is default value then you can throw an error stating "select other values".
Method 2 : You can use ItemData argument to specify the indices of items in the list. During validation, you can check if the selected element index is default then throw an error.
Here is the link which you can refer to
Hope this helps!

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by