how to display whole text in dropdownlist?

2 ビュー (過去 30 日間)
Muazma Ali
Muazma Ali 2021 年 12 月 26 日
回答済み: Image Analyst 2021 年 12 月 26 日
Hi
I have this code;
S={'NH4Cl'; 'MgCl2'; 'CaCl2'; 'KCl'; 'ZnSO4'; 'NaCl'; 'ZnBr2'; 'CH3CO2K';'HCOOK';'HCOONa'; 'CaBr2'};
str={'Choose salts available, minimum two and maximum three'};
result=listdlg('Promptstring',str, 'ListSize', [100,100], 'ListString', S, 'SelectionMode', 'multiple');
% I dont understand why the str is not showing the whole text on the screen

回答 (2 件)

Voss
Voss 2021 年 12 月 26 日
It is because you specify a 100 pixel by 100 pixel listbox, and str is too long to fit in that amount of space. You can either specify a larger listbox or use a cell array of character vectors or both, e.g.:
S={'NH4Cl'; 'MgCl2'; 'CaCl2'; 'KCl'; 'ZnSO4'; 'NaCl'; 'ZnBr2'; 'CH3CO2K';'HCOOK';'HCOONa'; 'CaBr2'};
str={'Choose salts available,' 'minimum two and' 'maximum three'};
result=listdlg('Promptstring',str, 'ListSize', [150,100], 'ListString', S, 'SelectionMode', 'multiple');

Image Analyst
Image Analyst 2021 年 12 月 26 日
Try increasing the size of the list window:
S={'NH4Cl'; 'MgCl2'; 'CaCl2'; 'KCl'; 'ZnSO4'; 'NaCl'; 'ZnBr2'; 'CH3CO2K';'HCOOK';'HCOONa'; 'CaBr2'};
str={'Choose salts available, minimum two and maximum three'};
result=listdlg('Promptstring',str, 'ListSize', [300,200], 'ListString', S, 'SelectionMode', 'multiple');

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by