How to write function for panel in App Designer?

I want to write a code for when any of the button from particular panel in App Designer is being selected then it will print that 'panel 1 is selected'

回答 (1 件)

Drishan Poovaya
Drishan Poovaya 2021 年 11 月 3 日

0 投票

You can access the panel a button was present in using the Parent property.
Firstly, give each panel an appropriate title in the component browser. Let's assume you have a panel called 'Panel One'.
In the ButtonPushed callback for every button, add the following 3 lines
s = event.Source.Parent.Title; % s = 'Panel One'
k = strcat(s, ' is selected');
disp(k)
Now when you click on the button, 'Panel One is selected' will be rpinted out to the command window.

3 件のコメント

SRUSHTI KHATAU
SRUSHTI KHATAU 2021 年 11 月 9 日
Thank you so much. Where can I learn more about this method you have used (Object Oriented).
What I have done is I used nested If and given or condition and added each push button value.
Drishan Poovaya
Drishan Poovaya 2021 年 11 月 12 日
You can refer to this link below, it has everything you need about app designer
Specifically to learn about events, refer below
SRUSHTI KHATAU
SRUSHTI KHATAU 2021 年 11 月 15 日
Thank you.

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

カテゴリ

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

質問済み:

2021 年 10 月 31 日

コメント済み:

2021 年 11 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by