Set edit uicontrol to last line
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Matt
il 17 Nov 2015
Risposto: Walter Roberson
il 17 Nov 2015
I used to do this by using:
h = uicontrol(....);
j = findjobj(h);
je = j.getComponent(0).getComponent(0);
je.setCaretPosition(je.getDocument.getLength);
Now I have Matlab 2015a and this is not working. Previously I downloaded findjobj from the exchange. I can no longer do this do to policy restrictions at work.
The situation I have is a figure that is displaying an edit uicontrol to act as a log for an application. I want the editbox to always show the last line. How can I do this? Is there a better control to use or a way to set the slider position to the end?
0 Commenti
Risposta accettata
Walter Roberson
il 17 Nov 2015
put a uicontrol('style','text') inside a uipanel and keep resizing it to be large enough to hold all current text. Create a scroll bar that adjusts the Position of the uicontrol within the uipanel.
It can be easier to work things out properly by having a uipanel 'B' inside a uipanel 'A', with the scroll bar in 'A' adjusting the Position of 'B' relative to 'A', with the uicontrol('style','text') inside B.
You might also want to look at http://www.mathworks.com/matlabcentral/fileexchange/29776-scrollpanel
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!