Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Edit Text Box: Fixed Value

Subject: Edit Text Box: Fixed Value

From: Adam

Date: 14 Jun, 2010 23:07:04

Message: 1 of 5

Hi,

I want the user to be able to copy and paste data from my GUI. Right now, I'm outputting data as a label. However, the user can't select and copy the label. Therefore, I'm hoping to switch to edit boxes. A couple problems I have though, is:

1) Changing the border of the edit box to match my background.
2) Changing it so that the value inside the box can be selected, but not changed.

I'm using GUIDE btw.

Thanks a lot,
Adam

Subject: Edit Text Box: Fixed Value

From: Matt Fig

Date: 14 Jun, 2010 23:16:04

Message: 2 of 5

See Q#16.

http://www.mathworks.com/matlabcentral/fileexchange/24861-41-complete-gui-examples


You should be able to adapt this to GUIDE.

Subject: Edit Text Box: Fixed Value

From: Adam

Date: 15 Jun, 2010 00:02:06

Message: 3 of 5

"Matt Fig" <spamanon@yahoo.com> wrote in message <hv6d7k$spr$1@fred.mathworks.com>...
> See Q#16.
>
> http://www.mathworks.com/matlabcentral/fileexchange/24861-41-complete-gui-examples
>
>
> You should be able to adapt this to GUIDE.

Thanks, any idea about changing the border color? Can this be done?

Subject: Edit Text Box: Fixed Value

From: Matt Fig

Date: 15 Jun, 2010 03:42:05

Message: 4 of 5

I am not sure what you mean by "border" color. If you mean the black line of a box around the editbox, then I do not think this is a settable property using plain MATLAB. I have seen the use of frame uicontrols to hide this. For example:


function [] = hide_border()

S.fh = figure('units','pixels',...
              'position',[500 500 200 180],...
              'menubar','none',...
              'name','hide_border',...
              'numbertitle','off',...
              'resize','off');
S.ed = uicontrol('style','edit',...
                 'units','pixels',...
                 'pos',[50 80 100 20]);
BGC = get(S.fh,'color');
uicontrol('style','frame',...
          'units','pixels',...
          'pos',[48 78 4 24],...
          'foregroundc',BGC,...
          'backgroundc',BGC)
uicontrol('style','frame',...
          'units','pixels',...
          'foregroundc',BGC,...
          'pos',[148 78 4 24],...
          'backgroundc',BGC)
uicontrol('style','frame',...
          'units','pixels',...
          'pos',[48 78 104 4],...
          'foregroundc',BGC,...
          'backgroundc',BGC)
uicontrol('style','frame',...
          'units','pixels',...
          'pos',[48 98 104 4],...
          'foregroundc',BGC,...
          'backgroundc',BGC)

Subject: Edit Text Box: Fixed Value

From: Yair Altman

Date: 15 Jun, 2010 08:43:08

Message: 5 of 5

"Matt Fig" <spamanon@yahoo.com> wrote in message <hv6sqd$t4v$1@fred.mathworks.com>...
> I am not sure what you mean by "border" color. If you mean the black line of a box around the editbox, then I do not think this is a settable property using plain MATLAB. I have seen the use of frame uicontrols to hide this. For example:

This can easily be done at the Java level, though. First download the FindJObj utility from the File Exchange, and then:

hEditbox = uicontrol('style','edit',...);
jEditbox = findjobj(hEditbox);
jEditbox.setBorder([]); % or: set(jEditbox,'Border',[])

Yair Altman
http://UndocumentedMatlab.com

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us