How to create an uicontrol with selectable but non-editable text.
6 次查看(过去 30 天)
显示 更早的评论
I want to allow user copy a text (or it's part) into clipboard in usual manner (selecting by mouse and pressing Ctrl-C). How to make it? A 'text' style uicontrol doesn't permit selection. Оn the other hand, an 'edit' style permits selection and copying to clipbord but also allows editing what is not desirable.
0 个评论
回答(2 个)
bbb_bbb
2018-4-25
编辑:bbb_bbb
2018-4-25
1 个评论
Ameer Hamza
2018-4-25
Worth mentioning that findjobj is not a MATLAB built-in function. It is available FEX::findjobj here.
Walter Roberson
2018-4-25
Hack the Java objects underlying the uicontrol.
But first experiment with setting the uicontrol enable property to 'disable'. The result is a uicontrol that can still scroll but not be edited. I do not recall whether it is selectable.
2 个评论
Dennis
2018-4-25
If it is okay to copy the entire text you could create a ButtonDownFcn that copies the string to clipboard.
function copytxt (hobj,~) mystring=get(hObj,'String'); clipboard('copy',mystring) end
另请参阅
类别
在 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!