How to move or relocate the figure window and message box?

조회 수: 18 (최근 30일)
Manoj Kumar
Manoj Kumar 2015년 1월 27일
답변: Robert Cumming 2015년 1월 27일
Hi,
I have 3 windows
1) Area Information
2) figure 1 with histogram information
3) Input Dialogbox
Here is the snapshot of that. My trouble is that, I couldn't able to move the 1 and 2 windows. I could able to move only window 3.
This is the code I used:
%code for Window1
regionData=regionprops(imageThresh,'basic');
minArea=min([regionData.Area]);
maxArea=max([regionData.Area]);
message=sprintf('Minimum Area = %d \n\nMaximum Area = %d',minArea,maxArea);
h=msgbox(message, 'Area Information' );
set(h,'Position',[350 499 150 70])
% code for window2
figure('name',sprintf('Histogram Information - %s',baseFileName),'NumberTitle','off');
hist([regionData.Area],20);
%code for window 3
prompt = {'Enter Minimum pixel area(default value is 2) - ',...
'Enter Maximum pixel area(default value is 100) -'};
dlg_title = 'Max/Min Pixel Area Selection';
num_lines = 1;
def = {'2','100'};
options.Resize='on';
answer=inputdlg(prompt,dlg_title,num_lines,def,options);
close;
Is there any method such that I can move all the 3 windows. I means to relocate the windows on the screen using the mouse cursor.
Thanks in advance.

채택된 답변

Robert Cumming
Robert Cumming 2015년 1월 27일
The reason you can only move window 3 is because by default an inputdlg is Modal (i.e. you cant access any other GUI until that one closes.
To change that add the following to your options struct:
options.WindowStyle = 'normal';
answer=inputdlg(prompt,dlg_title,num_lines,def,options);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dialog Boxes에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by