List dialog - Prompt text overlapp

3 ビュー (過去 30 日間)
Rakshith Badarinath
Rakshith Badarinath 2020 年 12 月 28 日
コメント済み: Rakshith Badarinath 2020 年 12 月 28 日
Hello,
I am trying to create a list dialog that accept a user input. I find that the prompt text doesn't display well and is overlapped with list. How to increase spacing between prompt text and list?
prompt = 'Select synchronization type for code generation (default=Trigg Mode)';
fn = {'Trigg Mode', 'SetAO Mode'};
[syncMode,tf] = listdlg('PromptString',prompt,'SelectionMode','single', ...
'ListString',fn,'ListSize',[200,100],'OKString','Select', 'Name','Select Sync Mode');
Changing 'ListSize' parameter only increases overall size of the window and doesn't solve the problem.

採用された回答

Cris LaPierre
Cris LaPierre 2020 年 12 月 28 日
"If you specify the prompt as a character vector that is longer than the width of the dialog box, the prompt clips. To create a multiline list box prompt, specify the prompt as a cell array or string array. Line breaks occur between each array element. Long elements wrap to fit the dialog box."
Try this
prompt = ["Select synchronization type for code","generation (default=Trigg Mode)"];
fn = {'Trigg Mode', 'SetAO Mode'};
[syncMode,tf] = listdlg('PromptString',prompt,'SelectionMode','single', ...
'ListString',fn,'ListSize',[200,100],'OKString','Select', 'Name','Select Sync Mode');
  3 件のコメント
Cris LaPierre
Cris LaPierre 2020 年 12 月 28 日
編集済み: Cris LaPierre 2020 年 12 月 28 日
It worked for me. This is what I see when I run the code I shared.
You do need to make each line a separate element. Otherwise, it just wraps.
Rakshith Badarinath
Rakshith Badarinath 2020 年 12 月 28 日
Yes! That was happening. I overlooked the comma seperation in your answer and just focused on converting character vector to string array. It works now

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Analytics Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by