Display times in App Designer components
34 次查看(过去 30 天)
显示 更早的评论
Using App Designer, I want to provide the user of an application with the ability to choose a date and time. The date is easy to achieve with the Date Picker component. I have not been able to find an obvious way to select a time. I could use the Edit Field (Text) component, but that would be too error prone (typos, formatting). I tried to use the Spinner and Edit Field (Numeric) components, but I could not find a way to change the format to a time. The 'ValueDisplayFormat' property of both allows you to create a custom format, but I couldn't figure out how to get a time format in this manner. Is there a way to make that work? I am new to App Designer, so I may be missing something obvious, or maybe App Designer does not give you the flexibility of manual programming or GUIDE. I want to avoid going down one of those paths, but how difficult would it be to make something programatically or using GUIDE to do what I want? How would I then incorporate that into an App Designer project? Are there other ways to allow a user to input times to applications created with App Designer? Maybe some creative way of using the existing components? Can you make your own custom components for use in App Designer? If so, what does that entail? Do people post components in the File Exchange?
Thanks for the help.
Matt
1 个评论
Peng Li
2020-4-15
"or maybe App Designer does not give you the flexibility of manual programming or GUIDE."
Just a commment that appdesigner definitely gives more flexibility than GUIDE. One example is the access of gui data using GUIDE is annoying as every time you have to remember this. OO offers clearly better way to access class properties.
appdesigner results in similar structure as you manually program an interface based class. If you check the appdesigner code, all interface components are generated within the CreateComponents methods, which is what you need to manually do if you start from scratch.
For the time part, I don't have a better clue. Hope someelse has. What I have done before is to place a simple edit field with some default message like HH:mm:ss to show users how to format the time. But unfortunately matlab doesn't have a good way to make this message a placeholder like what you have in Word/Powerpoint etc.
回答(1 个)
Ameer Hamza
2020-4-15
Although the time picker is not available in App designer, the attached app shows a workaround using UITable.
11 个评论
Ameer Hamza
2020-4-18
Pressing Tab key does not do anything in my case. I am using a macOS, and there might be a difference between platforms. However, pressing enter after typing a 4 does not revert back to 01. Please see this gif. You can consider adding breakpoints in the callback function and see what are the values of variables after you change the value in any cell
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!