Discussion:
questdlg() with access to data cursor
(too old to reply)
K
2011-11-10 20:00:43 UTC
Permalink
Hi all,

I'm using questdlg() to gain user input.
The question dialog box should determine whether the user wants to interact with other already opened figures or not.

I want to provide the user the access to other figures WHILE questdlg() is on.
According to MATLAB docs I should change questdlg WindowStyle property from 'modal' to 'normal'.

Would anyone tell me how do I do that?

Other solutions would be welcome as well.

Thx
K
Ben
2011-11-10 22:11:28 UTC
Permalink
Post by K
Hi all,
I'm using questdlg() to gain user input.
The question dialog box should determine whether the user wants to interact with other already opened figures or not.
I want to provide the user the access to other figures WHILE questdlg() is on.
According to MATLAB docs I should change questdlg WindowStyle property from 'modal' to 'normal'.
Would anyone tell me how do I do that?
Other solutions would be welcome as well.
Thx
K
To do that, youll have to set the Figure property:
http://www.mathworks.com/help/techdoc/ref/figure_props.html#WindowStyle
Phil Goddard
2011-11-11 07:17:11 UTC
Permalink
There is no mechanism for making questdlg non modal.
Within questdlg.m the figure is made model and uses uiwait to block processing until the window is closed.
Hence you do no have an opportunity to change the figure window's style to normal (from modal).

The workaround would be to make a copy of questdlg.m, call it customQuestdlg.m for instance, and modify it so that it doesn't make the figure model.
Presumably you'd need to change the callback's for the buttons too, as they currently close the dialog and you don't want that to happen.

Phil.
K
2011-11-11 14:45:30 UTC
Permalink
Post by Phil Goddard
There is no mechanism for making questdlg non modal.
Within questdlg.m the figure is made model and uses uiwait to block processing until the window is closed.
Hence you do no have an opportunity to change the figure window's style to normal (from modal).
The workaround would be to make a copy of questdlg.m, call it customQuestdlg.m for instance, and modify it so that it doesn't make the figure model.
Presumably you'd need to change the callback's for the buttons too, as they currently close the dialog and you don't want that to happen.
Phil.
Thx Phil!

if possible, I do not want to adapt questdlg.m.
Isn't there another way to gain user input in a button/radio buttons way and enable user modification of other already opened figures?

KD
Phil Goddard
2011-11-11 16:33:14 UTC
Permalink
There are no pre-built dialogs that do this (not that ship with MATLAB anyway, there may be something on the file exchange).
You will either need to write one from scratch or modify something that already exists.

Phil.
K
2011-11-12 08:15:27 UTC
Permalink
Post by Phil Goddard
There are no pre-built dialogs that do this (not that ship with MATLAB anyway, there may be something on the file exchange).
You will either need to write one from scratch or modify something that already exists.
Phil.
Thx Phil!
It would be good practice to construct one myself.
K
2011-11-12 11:49:11 UTC
Permalink
Post by K
Post by Phil Goddard
There are no pre-built dialogs that do this (not that ship with MATLAB anyway, there may be something on the file exchange).
You will either need to write one from scratch or modify something that already exists.
Phil.
Thx Phil!
It would be good practice to construct one myself.
Hello again,

Trying to follow your lead Phil.
I'm trying to implement a 3 push button group.
The push buttons should call the same callback function.

When activated, callback function should execute tasks based on the specific push button handle.
The problem is I do not know how to pass additional parameters to callback functions.

this is what I came with so far:

[code]


function exmpl()

close all;
plot(rand(1, 100), rand(1, 100), '.');
xlabel('wt [rad]');
ylabel('absolute value');

% Create the button group.
h = uibuttongroup('visible','off','Position',[0 0 1 0.04]);
% Create three radio buttons in the button group.
u0 = uicontrol('Style','pushbutton','String','Constructed selected points',...
'pos',[10 2 170 20],'parent',h,'HandleVisibility','off');
u1 = uicontrol('Style','pushbutton','String','Skip and close figure',...
'pos',[210 2 130 20],'parent',h,'HandleVisibility','off');
u2 = uicontrol('Style','pushbutton','String','Skip without close',...
'pos',[380 2 120 20],'parent',h,'HandleVisibility','off');
% Initialize some button group properties.
set(h,'SelectionChangeFcn',@pb_cbk);
% set(h,'SelectedObject',[]); % No selection
set(h,'Visible','on');

end

function pb_cbk(hObject,eventdata)
switch button_handle
case u0
...
...
end

[\code]
K
2011-11-12 14:55:15 UTC
Permalink
Post by K
Post by K
Post by Phil Goddard
There are no pre-built dialogs that do this (not that ship with MATLAB anyway, there may be something on the file exchange).
You will either need to write one from scratch or modify something that already exists.
Phil.
Thx Phil!
It would be good practice to construct one myself.
Hello again,
Trying to follow your lead Phil.
I'm trying to implement a 3 push button group.
The push buttons should call the same callback function.
When activated, callback function should execute tasks based on the specific push button handle.
The problem is I do not know how to pass additional parameters to callback functions.
[code]
function exmpl()
close all;
plot(rand(1, 100), rand(1, 100), '.');
xlabel('wt [rad]');
ylabel('absolute value');
% Create the button group.
h = uibuttongroup('visible','off','Position',[0 0 1 0.04]);
% Create three radio buttons in the button group.
u0 = uicontrol('Style','pushbutton','String','Constructed selected points',...
'pos',[10 2 170 20],'parent',h,'HandleVisibility','off');
u1 = uicontrol('Style','pushbutton','String','Skip and close figure',...
'pos',[210 2 130 20],'parent',h,'HandleVisibility','off');
u2 = uicontrol('Style','pushbutton','String','Skip without close',...
'pos',[380 2 120 20],'parent',h,'HandleVisibility','off');
% Initialize some button group properties.
% set(h,'SelectedObject',[]); % No selection
set(h,'Visible','on');
end
function pb_cbk(hObject,eventdata)
switch button_handle
case u0
...
...
end
[\code]
Got it.
I used the get() function to query the relevant push button who's handle is h0Object.
Eric
2016-03-02 17:18:03 UTC
Permalink
I know this is an old thread but hopefully this helps:


start(timer('StartDelay',1,'TimerFcn',@(o,e)set(findall(0,'Tag',questTitle),'WindowStyle','normal')));
questTitle='Replace Dialog';
choice = questdlg('Replacement OK?', questTitle, 'Yes','No','Cancel','Yes');
Eric
2016-03-02 17:23:03 UTC
Permalink
It might help to declare the title first...

questTitle='Replace Dialog'; start(timer('StartDelay',1,'TimerFcn',@(o,e)set(findall(0,'Tag',questTitle),'WindowStyle','normal')));
choice = questdlg('Replacement OK?', questTitle, 'Yes','No','Cancel','Yes');
Post by Eric
questTitle='Replace Dialog';
choice = questdlg('Replacement OK?', questTitle, 'Yes','No','Cancel','Yes');
Loading...