I would like multiple lines of text with a scrollbar that are not
selectable or editable.
Thanks.
No way is provided, unless it is one of the hidden java methods.
>I would like multiple lines of text with a scrollbar that are not
>selectable or editable.
This happens to be -exactly- what I'm coding right now.
I suspect someone has already done the work and put it up on the
File Exchange (FEX). (I didn't look there myself for copyright
reasons.)
--
If you lie to the compiler, it will get its revenge. -- Henry Spencer
If you want a *SELECTABLE* but *NON-EDITABLE* multi-line editbox, you
can't use Matlab's 'enable'='off' property, since the editbox will
not be selectable in this case. You have 2 options:
1. Creata a javax.swing.JTextPane or JTextArea object and place it
on-screen using javacomponent or uicomponent (from the File
Exchange). Then clear the object's Editable property while keeping
the Enabled property set. Here's a link describing the different
possible editboxes you can use:
<http://java.sun.com/docs/books/tutorial/uiswing/components/text.html>
2. Use findjobj from the File Exchange to clear Matlab's standard
editbox Editable property. This property is hidden in Matlab and
available only if you directly access the underlying Java object
(which is a JTextPane-inherited object, by the way). Here's how:
hEdit=uicontrol('style','edit','max',100,'enable','on',...);
jEdit=findjobj(hEdit,'nomenu'); %get the UIScrollPane container
jEdit=jEdit.getComponent(0).getComponent(0);
set(jEdit,'Editable',0);
BTW, you can use both these options to set other properties that are
unavailable in Matlab's standard uicontrol: CaretColor,
CaretPosition, DisabledTextColor etc.
Yair Altman
Is there a way to hide lateral scroll bar on multi-Line edit
boxes when scrolling is not needed ?
I tried to access and modify java graphic attributes trough
findjobj.m, but did not find those corresponding to scrolling.