Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
positioning of questdlg

Subject: positioning of questdlg

From: nor ki

Date: 15 Feb, 2008 10:05:04

Message: 1 of 13

Hi,

I use questdlg quite often and it always appears in the
middle of the screen, where it covers the information which
is needed for the answer.
Is it somehow possible to set its position?

thanks for your help in advance

kinor

Subject: positioning of questdlg

From: Vihang Patil

Date: 15 Feb, 2008 13:22:02

Message: 2 of 13

"nor ki" <kinor.removeme@gmx.de> wrote in message
<fp3o4f$nm3$1@fred.mathworks.com>...
> Hi,
>
> I use questdlg quite often and it always appears in the
> middle of the screen, where it covers the information
which
> is needed for the answer.
> Is it somehow possible to set its position?
>
> thanks for your help in advance
>
> kinor

You will have to modify the questdlg according to your
required position

edit questdlg

and modify the position property inside the code.

HTH
Vihang

Subject: positioning of questdlg

From: Ian Clarkson

Date: 15 Feb, 2008 13:27:02

Message: 3 of 13

"nor ki" <kinor.removeme@gmx.de> wrote in message
<fp3o4f$nm3$1@fred.mathworks.com>...
> Hi,
>
> I use questdlg quite often and it always appears in the
> middle of the screen, where it covers the information
which
> is needed for the answer.
> Is it somehow possible to set its position?
>
> thanks for your help in advance
>
> kinor

i took a look and didn't see much promising stuff. as a
workaround, you could write your own gui that does the same
thing as questdlg but has options to send it parameters for
location. shouldn't take too long...

Subject: positioning of questdlg

From: nor ki

Date: 15 Feb, 2008 15:32:19

Message: 4 of 13

thank the both of you for the hint, it?s no big deal but
surprsing that this option is missing

kinor

Subject: positioning of questdlg

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 15 Feb, 2008 17:42:33

Message: 5 of 13

In article <fp3o4f$nm3$1@fred.mathworks.com>,
nor ki <kinor.removeme@gmx.de> wrote:

>I use questdlg quite often and it always appears in the
>middle of the screen, where it covers the information which
>is needed for the answer.
>Is it somehow possible to set its position?

http://groups.google.ca/group/comp.soft-sys.matlab/msg/a3e0fe80bf02d691
Feb 1 2008
"Error Dialog Box (errordlg) Position"
by roberson@ibd.nrc-cnrc.gc.ca

Though that posting referred to errordlg, the same applies to
questdlg.
--
  "MAMA: Oh--So now it's life. Money is life. Once upon a time freedom
   used to be life--now it's money. I guess the world really do change.
   WALTER: No--it was always money, Mama. We just didn't know about it."
                                              -- Lorraine Hansberry

Subject: positioning of questdlg

From: Vihang Patil

Date: 15 Feb, 2008 18:01:02

Message: 6 of 13

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <fp4iu9$m5g$1@canopus.cc.umanitoba.ca>...

>
> http://groups.google.ca/group/comp.soft-
sys.matlab/msg/a3e0fe80bf02d691
> Feb 1 2008
> "Error Dialog Box (errordlg) Position"
> by roberson@ibd.nrc-cnrc.gc.ca
>
> Though that posting referred to errordlg, the same
applies to
> questdlg.

I dont think thats possible Walter, because errordlg gives
the handle of the figure to the output, while questdlg
doesnot, moreover, questdlg has to wait for the user input.

For the O.P:
If you want to design something similar to questdlg real
quick you can refer to my submission on "A small gui
Example" posted here
http://www.mathworks.com/matlabcentral/fileexchange/loadFil
e.do?objectId=18212&objectType=file.
You can place movegui(gcf, 'northwest'), or you preferred
position in the opening_fcn in that example..
HTH
Vihang

Subject: positioning of questdlg

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 15 Feb, 2008 18:08:43

Message: 7 of 13

In article <fp4k0u$7l3$1@fred.mathworks.com>,
Vihang Patil <vihang_patil@yahoo.com> wrote:
>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
>message <fp4iu9$m5g$1@canopus.cc.umanitoba.ca>...

>> http://groups.google.ca/group/comp.soft-
>sys.matlab/msg/a3e0fe80bf02d691
>> Feb 1 2008
>> "Error Dialog Box (errordlg) Position"
>> by roberson@ibd.nrc-cnrc.gc.ca

>> Though that posting referred to errordlg, the same
>applies to
>> questdlg.

>I dont think thats possible Walter, because errordlg gives
>the handle of the figure to the output, while questdlg
>doesnot, moreover, questdlg has to wait for the user input.

Good point, but I gave two solutions in that thread, and the
second one applies:

  The figure location for errordlg {and now questdlg} is given by
  the root property DefaultFigurePosition.

questdlg then potentially modifies it by calling
getnicedialoglocation to center the dialog in the upper third of
the screen.
--
  "We may gather out of history a policy, by the comparison and
  application of other men's forepassed miseries with our own like
  errors and ill deservings." -- Sir Walter Raleigh

Subject: positioning of questdlg

From: Vihang Patil

Date: 15 Feb, 2008 18:22:02

Message: 8 of 13

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <fp4kfb$ns4$1@canopus.cc.umanitoba.ca>...
> In article <fp4k0u$7l3$1@fred.mathworks.com>,
> Vihang Patil <vihang_patil@yahoo.com> wrote:
> >roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
> >message <fp4iu9$m5g$1@canopus.cc.umanitoba.ca>...
>
> >> http://groups.google.ca/group/comp.soft-
> >sys.matlab/msg/a3e0fe80bf02d691
> >> Feb 1 2008
> >> "Error Dialog Box (errordlg) Position"
> >> by roberson@ibd.nrc-cnrc.gc.ca
>
> >> Though that posting referred to errordlg, the same
> >applies to
> >> questdlg.
>
> >I dont think thats possible Walter, because errordlg
gives
> >the handle of the figure to the output, while questdlg
> >doesnot, moreover, questdlg has to wait for the user
input.
>
> Good point, but I gave two solutions in that thread, and
the
> second one applies:
>
> The figure location for errordlg {and now questdlg} is
given by
> the root property DefaultFigurePosition.
>
> questdlg then potentially modifies it by calling
> getnicedialoglocation to center the dialog in the upper
third of
> the screen.
> --
> "We may gather out of history a policy, by the
comparison and
> application of other men's forepassed miseries with
our own like
> errors and ill deservings." -- Sir
Walter Raleigh

Hello Walter
Could you please provide some suitable example.
I have not quite understood, how we could accomplish the
above by your method?

Vihang

Subject: positioning of questdlg

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 15 Feb, 2008 19:19:55

Message: 9 of 13

In article <fp4l8a$ph5$1@fred.mathworks.com>,
Vihang Patil <vihang_patil@yahoo.com> wrote:
>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
>message <fp4kfb$ns4$1@canopus.cc.umanitoba.ca>...
>> The figure location for errordlg {and now questdlg} is
>given by
>> the root property DefaultFigurePosition.

>> questdlg then potentially modifies it by calling
>> getnicedialoglocation to center the dialog in the upper
>third of
>> the screen.

>Could you please provide some suitable example.
>I have not quite understood, how we could accomplish the
>above by your method?

Tracing the code more carefully, I see that in fact the
DefaultFigurePosition values are obtained but then completely
ignored. The question dialog will be horizontally centered on the
figure (or on the screen if there is no current callback object),
and will be vertically set to start 1/3 of the way down the figure
(or screen).

Due to bugs in the code, the only way to affect the positioning
would be to change the root DefaultFigureUnits -- the
code uses absolute sizes for the question dialog box, but
uses DefaultFigureUnits as the units when it queries the size
of the figure or screen. The resulting mix could throw the
calculation off completely, positioning the question dialog in
strange places, I believe.
--
  "There is nothing so bad but it can masquerade as moral."
                                              -- Walter Lippmann

Subject: positioning of questdlg

From: nor ki

Date: 19 Feb, 2008 08:32:04

Message: 10 of 13

thank you both for the further discussion, setting a new
value for 'DefaultFigurePosition' has no effect, i just
changed questdlg

regards kinor

Subject: positioning of questdlg

From: Saeid

Date: 15 Apr, 2011 09:40:08

Message: 11 of 13

"nor ki" wrote in message <fp3o4f$nm3$1@fred.mathworks.com>...
> Hi,
>
> I use questdlg quite often and it always appears in the
> middle of the screen, where it covers the information which
> is needed for the answer.
> Is it somehow possible to set its position?
>
> thanks for your help in advance
>
> kinor


Hi,

It might be too late, but you can determine the question dialog box position on the screen by the Modified Function 'MFquestdlg':

http://www.mathworks.com/matlabcentral/fileexchange/31044-specifying-questdlg-position

Hope this helps.

Subject: positioning of questdlg

From: Andrew Bytheway

Date: 29 Jan, 2014 20:15:10

Message: 12 of 13

I found a solution that may benefit others trying to position a questdlg, inputdlg, or listdlg.

start(timer('TimerFcn',{@dialogpos,hParent},'TasksToExecute',1,'StartDelay',0.05));
resp = questdlg('Do you want to continue?','Question','Yes','No','Yes');

...

function dialogpos(inp1, inp2, parent)
    % Your code here
end

Subject: positioning of questdlg

From: Andrew Bytheway

Date: 29 Jan, 2014 20:31:08

Message: 13 of 13

Sorry, I accidentally submitted my response before I was done.

start(timer('TimerFcn',{@dialogpos,hParent},'TasksToExecute',1,'StartDelay',0.05));
resp = questdlg('Do you want to continue?','Question','Yes','No','Yes');

...

function dialogpos(inp1, inp2, parent)
    hDialog = gcf;
    % Your code here
end

As shown above, you can get the handle to the dialog (the current figure) by using the gcf function. Once you have the handle you can make changes to it's properties to your heart's content. In my case, I wanted to position the dialog relative to the parent. If you don't want that, then there is no need to include the parent argument.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us