how to make edit text in gui to show the latest result?

Hello!
i display my results in an edit text
set(handles.edit11, 'String', X);
However because the results are too many i cant see the latest results,unless i manually scroll down. any idea how to see the latest results while the are displayed?

2 件のコメント

Adam
Adam 2014 年 11 月 11 日
Can you not just show results in reverse order so that the latest are always at the top rather than the earliest?
alex
alex 2014 年 11 月 11 日
編集済み: alex 2014 年 11 月 11 日
nice thought Adam!it actually works!
however, by reversing the X and displaying it, that means time passing,and in my situation i miss some packets that i receive from a device. i want to display the results at real time.

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

回答 (2 件)

Yair Altman
Yair Altman 2014 年 11 月 10 日

1 投票

An example that contains what you wanted (to automatically set the caret position to the end of the editbox) is provided here: http://undocumentedmatlab.com/blog/rich-matlab-editbox-contents#EditorKit

1 件のコメント

alex
alex 2014 年 11 月 11 日
編集済み: alex 2014 年 11 月 11 日
thank you for your answer Yair, but i haven't figured it out yet.
I have an edit text in which i have set the Max value: 2.0
and i use this code
function edit11_Callback(hObject, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit11 as text
% str2double(get(hObject,'String')) returns contents of edit11 as a double
jScrollPane = findjobj(edit11);
jViewPort = jScrollPane.getViewport;
jEdit11= jViewPort.getComponent(0);
endPosition = jEdit11.getDocument.getLength;
jEdit11.setCaretPosition(endPosition);
But this doesn't work.. what should i do?
Thank you very much!

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

Image Analyst
Image Analyst 2014 年 11 月 10 日

0 投票

I don't know of any easy way to scroll down to the bottom of an edit text box. How about decreasing the font size? A non-easy way is to use Java robot.

カテゴリ

ヘルプ センター および File ExchangeEnvironment and Settings についてさらに検索

質問済み:

2014 年 11 月 10 日

編集済み:

2014 年 11 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by