Help: Display a different layout when pushing a button in a GUI?
古いコメントを表示
Hi all,
I'm trying to write a programmatic GUI. It includes a push button and a edit text named "tab1" when it initializes. Then when I hit the button the edit text "tab1" will be hidden and the GUI will show the edit text "tab2" which was invisible before hitting the button. I also attached my code which doesn't work.
Any help would be greatly appreciated.
Thanks.
採用された回答
その他の回答 (1 件)
Mikhail
2014 年 10 月 14 日
0 投票
Didn't see your code. In your push button callback function write: set("edit box id",'String','tab2'), where "edit box id" is your edit box identifier (It appears when you create it.)
5 件のコメント
Khanh
2014 年 10 月 14 日
Khanh
2014 年 10 月 14 日
Mikhail
2014 年 10 月 14 日
function []=pushbutton1_Callback(varargin) %#ok<INUSD>
S=varargin{3}
%set(S.tab1,'visible','off')
This is your pushbutton callback function. To make your tab2 visible write inside: set(S.tab2,'visible','on')
To make your tab1 invisible write inside:
set(S.tab1,'visible','off')
Note: you might have problem with arguments. Either use global variables (callback function is inside your main function) or at the step where you define your callback function for pushbutton insert additional arguments S.tab1, S.tab1
Khanh
2014 年 10 月 15 日
Mikhail
2014 年 10 月 16 日
Hi, no problem. What I recommend to you is to download something in Matlab exchanger and use it as a template for a first time, before you get enough experience.
カテゴリ
ヘルプ センター および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!