GUIDE: Text edit. Structure of handles.edit changed?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Sid
il 7 Lug 2015
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.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Environment and Settings in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!