Uidatepicker in app designer

조회 수: 8 (최근 30일)
Ricardo Pedó
Ricardo Pedó 2018년 4월 20일
댓글: Arshad Ilahi 2019년 12월 3일
Is there any way to place a uidatepicker element inside an existing app designer panel? The samples I've seen only show how to do that creating a new figure...
  댓글 수: 7
Ricardo Pedó
Ricardo Pedó 2018년 8월 13일
Great :)
Arshad Ilahi
Arshad Ilahi 2019년 12월 3일
Hello Eker,
Can you share what you did for placeing a uidatepicker element inside an existing app designer panel?

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

답변 (5개)

Chris Portal
Chris Portal 2018년 4월 21일
편집: per isakson 2018년 4월 21일

You can pass the panel’s handle as the parent for the uidatepicker. The syntax is described here:

https://www.mathworks.com/help/matlab/ref/uidatepicker.html


Ricardo Pedó
Ricardo Pedó 2018년 4월 21일
편집: per isakson 2018년 4월 21일

Thank you Chris. I've already read that link, but I couldn't undestand how to use panel as an object. May you show me an example? In my code I have app.Panel inside a TabGroup. I tried something like the example below, but it didn't work:

uidatepicker(app.Panel,'DisplayFormat','dd-MM-yyyy');
  댓글 수: 1
Chris Portal
Chris Portal 2018년 4월 21일
Hmm, that’s what you need to do. What is the error you’re getting?

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


Ricardo Pedó
Ricardo Pedó 2018년 4월 21일
Doing that way I don't get error message, but datapicker element don't show up in the panel...
  댓글 수: 1
Chris Portal
Chris Portal 2018년 4월 21일
If you instead parent a button to the panel at the same line of code, does the button show up?

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


Ricardo Pedó
Ricardo Pedó 2018년 4월 21일
No, now I got this error: Error using uidatepicker (line 44) Button cannot be a parent.
  댓글 수: 1
Chris Portal
Chris Portal 2018년 4월 21일
편집: per isakson 2018년 4월 21일

Sorry, I meant comment out your date picker line of code, and add this line of code:

b = uibutton(app.Panel);

Does the button show up in the panel? This will determine whether the issue is with date picker specifically or something else.

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


Ricardo Pedó
Ricardo Pedó 2018년 4월 21일
Ahh now I got your idea. Yes, the button shows up. Seems to be something related to the date picker...
  댓글 수: 2
Chris Portal
Chris Portal 2018년 4월 21일
편집: per isakson 2018년 4월 21일

Thanks. It looks to be a positioning bug specific to date picker. You can work around it by doing the following:

p = uidatepicker(app.Panel, ‘DisplayFormat’, ‘dd-MM-yyyy’);
p.Position(1:2) = [0 0];

I’ll report the bug for you. Thank you!

Ricardo Pedó
Ricardo Pedó 2018년 4월 21일
Yeah, that's the bug! It worked... Thank you Chris!!

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

카테고리

Help CenterFile 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!

Translated by