Combining inputdlg with listdlg

35 Ansichten (letzte 30 Tage)
ANOOP VK
ANOOP VK am 5 Mär. 2018
Beantwortet: Anton Angov am 21 Dez. 2020
Hello,
I want to create a dialog box, were it should have text space and list drop down .
With inputdlg i can create the text field, but cannot find a way to add a drop down list into that.
Or is there any other type of dialog box function available?

Antworten (2)

Jan
Jan am 5 Mär. 2018
No, there is no pre-defined function for this. But you can simply create one:
function yourDlg(Str, List)
dialog('Position', [100, 100, 400, 600]);
uicontrol('Style', 'ListBox', 'String', List, ...
'Position', [10, 530, 380, 30]);
uicontrol('Style', 'Edit', 'String', Str, ...
'Position', [10, 10, 380, 500]);
end
You can copy the code from listbox.m or inputdlg.m easily and add the needed lines by your own. Anyway, creating a GUI is not complicated.
  2 Kommentare
franco otaola
franco otaola am 31 Jan. 2020
hello,
i have already a imput dialog with several imputs, and i would like to add at the end a drop down menu,
is it possible? from your answer i would say yes, but i couldnt get how to do it. could you be more specific?
thanks
Rik
Rik am 31 Jan. 2020
Note that the above comment was posted as a separate question.

Melden Sie sich an, um zu kommentieren.


Anton Angov
Anton Angov am 21 Dez. 2020
Having a similar problem, and spending some time on research, I was able to find the following post from 2009:
Even that the post is quite old, if you follow up the inputsdlg() function link you will find that it has been updated and is working quite well. Instead of spending time to implement something with this functionality, in my case reusing this function is all I needed.
The zip file containing the function and some examples can be downloaded from here:

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by