Effacer les filtres
Effacer les filtres

how to display whole text in dropdownlist?

1 vue (au cours des 30 derniers jours)
Muazma Ali
Muazma Ali le 26 Déc 2021
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

Réponses (2)

Voss
Voss le 26 Déc 2021
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 le 26 Déc 2021
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');

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by