GUIDE: Text edit. Structure of handles.edit changed?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello -
This could be really trivial but I don't seem to figure it out what went wrong. I have a GUI that user browse to a directory, then I have an edit text box performs some regexp operation of the directory name and give an output in the text box - which the users can leave it as if if they're happy with the choice or do any modification. The problem I'm having is that if they user leaves the text as is, I can retrieve the text from handles.edit.String (or get(handles.edit,'String'). If text box gets modified, the UIcontrol structer disappears, and the input text is store as handles.edit.
Is there a way to keep the structure of the variable the same so I don't have to do any precheck on handles.edit? What could I may have done incorrectly? I'm using R2015a.
Thank you for any suggestion! Pearl
댓글 수: 0
채택된 답변
Sid
2015년 7월 7일
The easiest solution might be to create a separate function (say, formatString ) that is the callback for the editbox and the pushbutton (which I am guessing is how the user can browse to the desired directory.)
The formatString function will serve the sole purpose of doing the regexp to format the string, and set the output to the editbox string.
Doug Hull (or Stuart now) had a good example here on this kind of operation. It might be worth the few minutes to watch? You can find the video here .
Again, the message is set up one function that can be called upon from different locations (in this case the original pushbutton and then the editbox .) This way, it might be easier to scale up later on.
A bit of a long-winded answer, but HTH.
추가 답변 (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!