Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to make a msgbox without 'ok' button

1,445 views
Skip to first unread message

Wes

unread,
Feb 22, 2006, 9:12:02 AM2/22/06
to
How can I make a dialog box or msgbox but without 'OK" button?

Thanks

chmical

unread,
Feb 22, 2006, 9:17:16 AM2/22/06
to
Wes wrote:
>
>
> 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

Randy Poe

unread,
Feb 22, 2006, 10:31:45 AM2/22/06
to

Wes wrote:
> 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

Wes

unread,
Feb 22, 2006, 2:54:28 PM2/22/06
to
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

chmical

unread,
Feb 22, 2006, 3:07:57 PM2/22/06
to
This would get you started. But you will have to modify it... help
uicontrol

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

Chmical

Randy Poe

unread,
Feb 22, 2006, 3:23:31 PM2/22/06
to

Wes wrote:
> 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

Nathan Orloff

unread,
May 9, 2013, 12:16:09 PM5/9/13
to
h = msgbox('This could be a minute. Patience, grasshopper...','Importing Images','help');
child = get(h,'Children');
delete(child(3))

Pedro Busc

unread,
Mar 30, 2017, 1:35:08 PM3/30/17
to
"Nathan Orloff" wrote in message <kmgi49$lci$1...@newscl01ah.mathworks.com>...
> 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
0 new messages