Discussion:
How to make a msgbox without 'ok' button
(too old to reply)
Wes
2006-02-22 14:12:02 UTC
Permalink
How can I make a dialog box or msgbox but without 'OK" button?

Thanks
chmical
2006-02-22 14:17:16 UTC
Permalink
Post by Wes
How can I make a dialog box or msgbox but without 'OK" button?
Thanks
Wes,

What type of information are you wanting to display? Do you want the
button to say something else or for the box to have no button at all?

Chmical
Wes
2006-02-22 19:54:28 UTC
Permalink
Chmical,

I want to show just a message without 'ok' button to explain a step
to the user. Once the user does as it is explained in the message,
my source code will close the message box so that the user will not
need to select 'ok' button.

Thanks
Wes
Post by chmical
Post by Wes
How can I make a dialog box or msgbox but without 'OK" button?
Thanks
Wes,
What type of information are you wanting to display? Do you want the
button to say something else or for the box to have no button at all?
Chmical
chmical
2006-02-22 20:07:57 UTC
Permalink
This would get you started. But you will have to modify it... help
uicontrol

uicontrol('Style','text','String','hi')

Chmical
Nathan Orloff
2013-05-09 16:16:09 UTC
Permalink
h = msgbox('This could be a minute. Patience, grasshopper...','Importing Images','help');
child = get(h,'Children');
delete(child(3))
Pedro Busc
2017-03-30 17:35:03 UTC
Permalink
Post by Nathan Orloff
h = msgbox('This could be a minute. Patience, grasshopper...','Importing Images','help');
child = get(h,'Children');
delete(child(3))
The correct is child(1).
Full function:

function h = MessageBox(message,title,messageType,hideOk)
% Show message box
% Source: https://www.mathworks.com/matlabcentral/newsreader/view_thread/117288

if ~exist('messageType','var')
messageType = 'help';
end

if ~exist('hideOk','var')
hideOk = 1;
end

h = msgbox(message,title,messageType);
child = get(h,'Children');

if hideOk
delete(child(1)); % Removes ok button
drawnow;
end

end

Randy Poe
2006-02-22 20:23:31 UTC
Permalink
Post by Wes
Chmical,
I want to show just a message without 'ok' button to explain a step
to the user. Once the user does as it is explained in the message,
my source code will close the message box so that the user will not
need to select 'ok' button.
OK, here's sort of a kluge-y way to do it. This creates
a message box, then deletes everything that isn't the
actual message.

h=msgbox('Message','Title');
delete(findobj(h,'string','OK'));
delete(findobj(h,'style','frame'));

- Randy
Randy Poe
2006-02-22 15:31:45 UTC
Permalink
Post by Wes
How can I make a dialog box or msgbox but without 'OK" button?
You can use DIALOG to create a generic dialog box, and then
add whatever controls, text, etc you want with UICONTROL.
That stuff is all done for you within such functions as MSGBOX.

What behavior do you want? You just want a box with an
informational message and no OK button, but which can
be closed by the user by closing the window?

- Randy
Continue reading on narkive:
Loading...