MATLAB Answers


Enable or Disable an Edit Text

Asked by Melvin
on 24 Feb 2012

Hi everyone. What code to use under a push button if I want to enable or disable an "edit text" when that push button is clicked? Thank you very much.

  1 Comment

I hope someone answers my question...Thank you in advance


No products are associated with this question.

1 Answer

Answer by Walter Roberson
on 24 Feb 2012
 Accepted answer

set(handles.TheTextBox, 'enable', 'off')

Note: there is also 'disable' instead of 'off'. When it is 'disable', the text is still there and still readable and scrollable, but cannot be changed.

  1 Comment

It's actually 'inactive', not 'disable', instead of 'off'. Maybe they changed it. But I see no significant difference between the two other than 'off' greys out the background while 'inactive' leaves it white. But neither one of them allow for selecting/highlighting.

Join the 15-year community celebration.

Play games and win prizes!

Learn more
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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!