- 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
6 次查看(过去 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!