Uidatepicker in app designer

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 件のコメント

Omer Eker
Omer Eker 2018 年 8 月 8 日
Hi Ricardo, I am new to appdesigner, but i like it very much. I didnt get whether you managed to see datepicker component in the component list (left pane). If not, how was your problem solved?
Ricardo Pedó
Ricardo Pedó 2018 年 8 月 10 日
Hello Omer,
I've done that Chris said, using Position(1:2) to turn my uidatepicker visible in the Panel. To do that, I've been changing the position values until this gets in the right place:
app.dataIni = uidatepicker(app.Panel, 'DisplayFormat', 'yyyy-mm-dd', 'Value', datetime('today')); app.dataIni.Position(1:2) = [20 5];
Omer Eker
Omer Eker 2018 年 8 月 11 日
Ricardo, thanks for the reply. Where do I put these 2 lines in my appdesigner codes?
Omer Eker
Omer Eker 2018 年 8 月 12 日
OK managed to have the datepicker component in my panel. But it only appears when the button was clicked. I need it to be appeared all the time there, can we do that?
Omer Eker
Omer Eker 2018 年 8 月 12 日
OK that one is sorted too :)
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 日

0 投票

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 日

0 投票

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 日

0 投票

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 日

0 投票

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 日

0 投票

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

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDevelop Apps Using App Designer についてさらに検索

質問済み:

2018 年 4 月 20 日

コメント済み:

2019 年 12 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by