How to display a message in GUI when a button is clicked?
21 ビュー (過去 30 日間)
古いコメントを表示
I have a "load" pushbutton in GUI and since I have a lot of data, it usually takes about several minutes for it to load, and I would like my GUI to display a message saying "loading" until the data is loaded. (The message will be gone once the loading the complete) So my user won't be wondering why the GUI has not worked and close the GUI...
What should I look into to achieve this? Does anyone have an example of a similar situation? Thank you!
2 件のコメント
Shameer Parmar
2016 年 7 月 27 日
Yes,
There are different ways you can achieve it..
1. You can add simple static textbox with blank string and then once you run (click) push button, display the message and once done, make it blank or change to 'Successfully Done'.
The another method is, you can use numbers of static textbox with small in size connected in row, then once you click on push button, change the BackGroundColor to red one-by-one, so that it will looks like progressBar, as follows:
採用された回答
Image Analyst
2016 年 7 月 27 日
編集済み: Image Analyst
2016 年 7 月 27 日
At the end of your OpeningFcn function put a drawnow after you set the statis text label.
handles.test1.String = 'Please wait...Loading data...';
drawnow;
Hopefully that will show your GUI on screen. Your OutputFcn function runs after your OpeningFcn, so put all your data loading operations into that function.
s = load(yourDataFile); % Load your data somehow.
handles.test1.String = 'Done loading data...Ready for you to use!';
drawnow;
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!