App designer push button and list option
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Hello, I was wondering how to turn off push button. Which forces the user to make a selection from a list on that same screen. Once the selection has been made then the push button turns on.
採用された回答
Voss
2022 年 11 月 8 日
Set the 'Enable' property of the pushbutton.
13 件のコメント
Nwasinachi
2022 年 11 月 8 日
Hello, i have tried that and it isnt working.
i want the user to select an option on the list.
When they do that the push button becomes enabled, and now they can use the push button, the issue is that i am using app designer so the intergration seems to not work.
i have attached a screenshot.
thank you.
Voss
2022 年 11 月 8 日
"i have attached a screenshot."
Where?
Nwasinachi
2022 年 11 月 8 日
% Callbacks that handle component events
methods (Access = private)
% Callback function
function ListBoxValueChanged(app, event)
end
% Value changed function: ListBox
function ClicktocontinueButtonPushed(app, event)
end
end
% Component initialization
methods (Access = private)
Nwasinachi
2022 年 11 月 8 日
i apologize it didnt include the screenshots for some weird reason, but i have attached the areas that seems to be causing the issue
Inside the listbox ValueChangedFcn (a.k.a., "callback") is where you'd set the 'Enable' state of the uibutton.
It's not clear to me which of those two functions is intended to be the listbox callback; the name of ListBoxValueChanged suggests that that's it, but the comment before ClicktocontinueButtonPushed says that's it, but its name suggests it is the uibutton callback.
It may be that these functions are not associated properly with their respective controls.
Nwasinachi
2022 年 11 月 9 日
I have made adjustment to the code and corrected the error the whole point is that when a selection on the list box is made then the pushbutton becomes enabled.
The code is still not working. it looks like this now. Thank you.
% Callbacks that handle component events
methods (Access = private)
% Value changed function: ListBox
function ListBoxValueChanged(app, event)
value = app.ListBox.Value;
if app.ListBox.Value =='18-28';
app.ClicktocontinueButton,'Enable',"on"
end
end
end
Image Analyst
2022 年 11 月 9 日
@Nwasinachi do not compare strings like this
if app.ListBox.Value =='18-28';
use strcmpi
if strcmpi(app.ListBox.Value, '18-28')
Nwasinachi
2022 年 11 月 10 日
Just tried that and the if loop doesnt seem to be working at disabling the pushbutton and reenabling it when an option on the list is clicked.
Voss
2022 年 11 月 10 日
@Nwasinachi: This syntax is incorrect:
app.ClicktocontinueButton,'Enable',"on"
It should be like this:
app.ClicktocontinueButton.Enable = 'on'
or this:
set(app.ClicktocontinueButton,'Enable','on')
Nwasinachi
2022 年 11 月 10 日
Thank you so much. it worked.
Voss
2022 年 11 月 10 日
You're welcome! If you have any other questions, let me know. Otherwise, please "Accept this Answer". Thanks!
Nwasinachi
2022 年 11 月 10 日
i do have another question regarding app designer and merging several m.lapp into one m.lapp.
Voss
2022 年 11 月 10 日
@Nwasinachi: It's probably best to post that as a new question.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および 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!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
