필터 지우기
필터 지우기

Using a GUI popup menu to change an Edit Text box

조회 수: 1 (최근 30일)
Adam Kaas
Adam Kaas 2012년 5월 18일
I'm hoping I can get some help without having to submit a picture or my code, but I have a GUI setup up with numerous edit text fields. I have some different "profiles" set up that I can select from using a popup menu. What I'd like to see happen is when I change from one "profile" to another, the edit text boxes will all change to the values represented by that profile. Currently the values are getting stored correctly as my plots turn out correctly when I plot my different profiles, but the edit text boxes look like they'd be plotting the initial values they have when I start up the mfile.. Is this possible?
  댓글 수: 1
Adam Kaas
Adam Kaas 2012년 5월 18일
If I'm not using the set() function to edit the text boxes when one of these profiles are selected, is there a way to do this?

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

채택된 답변

Walter Roberson
Walter Roberson 2012년 5월 18일
After you have set() the edit boxes to their new values, drawnow() to allow the display to update.
  댓글 수: 2
Adam Kaas
Adam Kaas 2012년 5월 18일
Currently I'm not using a set() function to change the edit boxes. I have 23 profiles set up, and one of them is listed as "Manual." When using the manual profile, it will get() the values from the edit boxes, otherwise the other profiles don't even use the edit boxes. Suggestions? Thank you as well for your help so far.
Walter Roberson
Walter Roberson 2012년 5월 18일
I am not clear what your goal is. If you want the edit boxes to update even when not using Manual, then use set() to change their String property. If you want the edit boxes to go gray to reflect that their value is not being used, use set() to change their Enable property to 'off'.

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

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2012년 5월 18일
After the popup menu returns and gives you the information you need, extract this information and then set the 'string' property of the edit boxes to be the new info:
%Example uicontrol
h = uicontrol('units','norm','pos',[0.2 0.2 0.6 0.6],'style','edit','string','Hello World');
To change its size and string:
%Now let's set it to be something different:
set(h,'string','It''s Friday!','pos',[0.4 0.4 0.2 0.2]);
  댓글 수: 1
Adam Kaas
Adam Kaas 2012년 5월 18일
Thank you for your help! Combining ideas from both you and Walter, I was able to figure it out!

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

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by