Why are the INPUTDLG, LISTDLG, QUESTDLG, FINISHDLG, and all other modal dialog GUI's sometimes partially hidden when displayed on the MATLAB desktop?

11 views (last 30 days)
Why are the INPUTDLG, LISTDLG, QUESTDLG, FINISHDLG and all other modal dialog GUI's sometimes partially hidden when displayed on the MATLAB desktop?
This occurs in both MATLAB 6.0 (R12) and MATLAB 6.1 (R12.1) on Windows.
Using the input dialog box "INPUTDLG", a list dialog box "LISTDLG", or a question dialog box "QUESTDLG" sometimes results in partially hidden and corrupted dialog boxes. The problem is not consistent, but tends to occur when the MATLAB desktop is not minimized or maximized (i.e. MATLAB only partially covers the Windows desktop).
To reproduce this behavior, use the following code:
a = inputdlg({'hi'})
or:
d = dir;
str = {d.name};
[s,v] = listdlg('PromptString','Select a file:',...
'SelectionMode','single',...
'ListString',str)
Note that if the dialog box covers the title bar in MATLAB, the response seems even more likely.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This is a bug that has been fixed in MATLAB 6.5 (R13).
If you are using MATLAB 6.0 (R12) or MATLAB 6.1 (R12.1), one workaround is to make sure that the dialog boxes do not overlap with any other MATLAB windows.
Use the following example in order to specify the location of the listbox:
deffigpos=get(0, 'defaultfigureposition');
a=300; %Can change position of the listbox by changing values for a and b
b=100;
figpos=[a b deffigpos(3:4)];
set(0,'defaultfigureposition',figpos);
d = dir;
str = {d.name};
[s,v] = listdlg('PromptString','Select a file:',...
'SelectionMode','single',...
'ListString',str)
set(0,'defaultfigureposition',deffigpos);
You can change the location of the listbox by changing the values of a and b.
Another possible workaround is to add a small delay to your code before displaying the dialog box. For example:
for i=1:100000
dummy=log(i);
end
This delay gives the desktop enough time to redraw itself before the dialog displays.
Note that using "pause(n)" will not work because the desktop does not redraw itself until after the pause.

More Answers (0)

Categories

Find more on Dialog Boxes in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!