- 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 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Baha411
am 10 Mai 2019
Beantwortet: Vencel Kozma
am 23 Jan. 2023
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 10 Mai 2019
4 Kommentare
Walter Roberson
am 13 Mai 2019
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.
Weitere Antworten (1)
Vencel Kozma
am 23 Jan. 2023
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 Kommentare
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!