How to extend horizontally this inputdlg window?
Mostrar comentarios más antiguos
Dear all,
I have this code for inputdlg window:
prompt = {'Nastavení výšky modelu:','Nastavení jemnosti sítě modelu:','Nastavení počtu elektrod:','Nastavení vzdálenosti mezi elektrodami:','Nastavení poloměru elektrod:','Nastavení tvaru elektrod:','Nastavení jemnosti sítě elektrod:','Nastavení normy - doplnit:'};
dlg_title = 'Nastavení parametrů modelu';
num_lines = 1;
defaultans = {'1','0.8','16','1','0.05','0','0.4','256'};
answer = inputdlg(prompt, dlg_title,num_lines, defaultans);
I would like to extend horizontally this window, because there isn´t display title of window. Can you advise me?
Respuesta aceptada
Más respuestas (2)
Don't see a way programmatically, TMW didn't expose the rest of the control properties thru the provided interface, unfortunately.
...[Previous use of longer prompt to fudge field width elided for brevity--dpb]...
Just point out one way to implement the TMW-suggestion linked to by IA and as fixed-width by SS above...
N=max(length(dlg_title),max(cellfun(@length,prompt)))+1; % get max length + offset
numel=repmat([1 N],length(prompt),1); % build numel array from inputs
Empirically the '+1' above was just enough; as observed in above comment this is an empirical adjustment, unfortunately.
What a kludge, though! :( This should be cited and an enhancement request submitted to TMW www.mathworks.com official support.
Image Analyst
el 11 de Mzo. de 2017
0 votos
There is a way to do it and I give the answer here: https://www.mathworks.com/matlabcentral/answers/101326-how-can-i-make-an-input-dialog-box-created-by-inputdlg-wide-enough-to-show-the-entire-title#comment_234405
1 comentario
Ah...shoulda' read the doc more carefully, the TMW-supplied answer at the above link uses the array form for the num_lines parameter where the first column is number of lines for each prompt while the second is the width of the column. So, add the characters of the difference between length of title and prompt plus some for the field width and the prompt boxes will be wide-enough.
Much cleaner than the above forcing a long-enough title for a prompt, but similar "trick" to force the sizing algorithm to work.
Be much better if TMW would do this internally, though; why wouldn't one if given the task to implement the UI? Or perhaps there was no internal test that uncovered the case of title display length > prompt length so it all seemed to work fine in internal test suite?
Categorías
Más información sobre Title en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!