Display times in App Designer components

28 visualizzazioni (ultimi 30 giorni)
Matt
Matt il 15 Apr 2020
Commentato: Matt il 24 Apr 2020
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 Commento
Peng Li
Peng Li il 15 Apr 2020
"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.

Accedi per commentare.

Risposte (1)

Ameer Hamza
Ameer Hamza il 15 Apr 2020
Although the time picker is not available in App designer, the attached app shows a workaround using UITable.
  11 Commenti
Ameer Hamza
Ameer Hamza il 18 Apr 2020
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
Matt
Matt il 24 Apr 2020
I ended up using 3 spinner components side-by-side as a workaround. I was able to enter values the way I wanted on my system.

Accedi per commentare.

Categorie

Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by