- You can set a uicontrol style edit 'Enable' to 'inactive' to have a text box that cannot be modified but can be scrolled. Unfortunately, selection is disabled . You would have to go in at the java level to do better.
- There is no hope of getting tex or latex in a uicontrol style edit, other than going in at the Java level.
Noneditable "edit text" box to be able to select and copy part of the text
조회 수: 13 (최근 30일)
이전 댓글 표시
Hi,
1. Is there a way to create an "edit text" box, but don't allow it to be edited or modified? I want it so that a part of text can be selected and copied.
I don't want to do it with creating a button to copy entire text into the clipboard. I am trying to get capabilities of selecting a part of text and copying it, not the full text.
h = uicontrol('Style','edit','Position',[10 10 300 100],...
'min',0,'max',2,'enable','on');
str = {['x^2+e^{\pi i} Since its founding in 1984, MathWorks has become the leading ',...
'global provider of technical computing and model-based design ',...
'software. Headquartered in Natick, Massachusetts, MathWorks ',...
'global provider of technical computing and model-based design ',...
'software. Headquartered in Natick, Massachusetts, MathWorks ',...
'currently employs more than 1,000 people worldwide. ']};
set(h,'String',str) % display the string
2. I am also trying to get that equation to show up in tex or latex format, couldn't get around it. That's my second question how to get an equation to show up in an edit text box.
댓글 수: 0
채택된 답변
Walter Roberson
2019년 5월 10일
댓글 수: 4
Walter Roberson
2019년 5월 13일
Live Script does refer to .mlx files.
At present, Live Script is useful for creating documents with executable parts, in which you can insert headers and lines of text that include equations. However, I do not yet know of any way to dynamically construct equations to be displayed in Live Script.
추가 답변 (1개)
Vencel Kozma
2023년 1월 23일
I have a workaround for that.
1. - Create a class (e.g.: "gui_status"), where you could store the correspondent text:
classdef gui_status < handle
properties
...
status_message string
end
end
2.- Create an instance inside the gui's handle like:
handles.gui_status.status_message = "";
3.- Every time you want to change the string of an "edit" object (e.g.: "edit_message"), you also store it in your new instance as well:
...
handles.gui_status.status_message = handles.edit_message.String;
...
4.- In the Callback function of "edit_message" (if you modify the text unintentionally), you could re-set it with the so-called instance:
function edit_message_Callback(hObject, eventdata, handles)
% hObject handle to edit_message (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.edit_message.String = handles.gui_status.status_message;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!