Help: Display a different layout when pushing a button in a GUI?

조회 수: 1 (최근 30일)
Khanh
Khanh 2014년 10월 14일
편집: Khanh 2014년 10월 17일
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.
  댓글 수: 2
Robert Cumming
Robert Cumming 2014년 10월 16일
Which Matlab version are you using?
Khanh
Khanh 2014년 10월 17일
Hi Robert
I'm using MATLAB 2014a.

댓글을 달려면 로그인하십시오.

채택된 답변

Robert Cumming
Robert Cumming 2014년 10월 17일
The reason your code doesn;t work - is that when the callback for the pushbutton is created the variable S.tab1 doesn't exist. If you moved the pushbutton creation to the end then it would work.
It looks like you are trying to build a GUI with tabs?
If you looking for an off the shelf solution look here
A good place to start to learn about GUIs is to use this FEX submission
  댓글 수: 1
Khanh
Khanh 2014년 10월 17일
편집: Khanh 2014년 10월 17일
I'm trying to build a GUI with multi tab. Really thank you. I moved the set callback for the push button on the callback function line immidiately, it worked.
Thanks for your addtional advice.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Mikhail
Mikhail 2014년 10월 14일
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
Khanh 2014년 10월 15일
Hi Mikhail
Thanks for you answers.
Although I used both ways, it doesn't work. I went around whole day but I still don't understand my problem.
Mikhail
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by