How to allow for multiline input for inputdlg?

조회 수: 23 (최근 30일)
Rafidul Islam
Rafidul Islam 2021년 6월 26일
댓글: Rafidul Islam 2021년 6월 27일
Hello guys,
For my Octave program, I use a lot of inputdlg, but for all of them, the textbox is only one line long. Despite increasing the number of lines (num_lines) for each inputdlg, I am still only able to write one line of text amidst the textbox getting taller. The text does not move to the next line when I hit the right end of the textbox. Is there any way around this? Here's a snippet of my code below:
num_lines = 1;
cues = {'lake', 'river', 'water', 'ocean', 'forest'};
index1 = randi([1,5]);
answer = inputdlg(sprintf('Please detail any memory with the following word in mind: %s. Press enter when you are done.',cues{index1}),'Past Memory Exercise 1',num_lines);

답변 (1개)

Ive J
Ive J 2021년 6월 27일
Have you tried new line?
num_lines = 1;
cues = {'lake', 'river', 'water', 'ocean', 'forest'};
index1 = randi([1,5]);
answer = inputdlg(sprintf('Please detail any memory\nwith the following word in mind: %s.\nPress enter when you are done.',cues{index1}),'Past Memory Exercise 1',num_lines);
  댓글 수: 1
Rafidul Islam
Rafidul Islam 2021년 6월 27일
This creates new lines within the prompt, but I want new lines within the input box itself. I tried using num_lines and despite the box getting taller, I can't write new lines of text in it.

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

카테고리

Help CenterFile Exchange에서 Octave에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by