Enable or Disable an Edit Text

조회 수: 9 (최근 30일)
Melvin
Melvin 2012년 2월 24일
댓글: Mike D. 2017년 2월 28일
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
Melvin
Melvin 2012년 2월 24일
I hope someone answers my question...Thank you in advance

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2012년 2월 24일
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.
  댓글 수: 2
Patrick
Patrick 2013년 5월 15일
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.
Mike D.
Mike D. 2017년 2월 28일
No, they didn't change it, the "Enable" property of an edit box has three modes: on, off or inactive. The user can only modify it contents when Enable = on. Yea, off greys it out while inactive leaves it white. I noticed if you use an edit box as a memo box with many lines of text (and vertical scroll bar), you can't use the vertical scroll bar if the edit box is off, but can if its inactive.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by