GUIDE: Text edit. Structure of handles.edit changed?

4 ビュー (過去 30 日間)
Pearl
Pearl 2015 年 7 月 7 日
コメント済み: Pearl 2015 年 7 月 7 日
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

採用された回答

Sid
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.
  1 件のコメント
Pearl
Pearl 2015 年 7 月 7 日
Thank you very much for prompt response, Sid! The video was surely helpful.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by