3.71429

3.7 | 7 ratings Rate this file 60 downloads (last 30 days) File Size: 2.8 KB File ID: #15288

Display message window

by Panagiotis Moulos

 

13 Jun 2007 (Updated 13 Jun 2007)

Code covered by BSD License  

A simple message window similar to msgbox without button

Download Now | Watch this File

File Information
Description

SHOWINFOWINDOW creates a small dialog window which displays a user-defined message. It is quite like MATLAB's msgbox but without an OK button. Although msgbox could be used for the simple display of a message that informs the user about a process being performed (and is not expected to last long, else a waitbar/timebar could be used but at a cost of running time), the presence of the OK button that closes the window on press could be annoying. SHOWINFOWINDOW resolves this problem by removing the button. Additionally, if you wish to write a script or create a GUI where you do not wish the user to accidenatlly hit the close button in the upper right corner of the window, you can remove the comment on line 82 of the code concerning the 'CloseRequestFcn' property of the dialog. However, if you do that you must assign a handle to showinfowindow so you can change its 'CloseRequestFcn' property to 'closereq' when your process is done or else you might end up with a non-closing window! If that happens, one way to resolve this could be to use the findobj function:

non_closing_window_handle = findobj('CloseRequestFcn','');
set(non_closing_window_handle,'CloseRequestFcn','closereq')
close(non_closing_window_handle)

Although this script was created for something trivial, I found it useful especially in my GUIs where I wanted to briefly display some information in a very simple way and especially when I wanted to avoid someone causing such windows to close when running a process within a GUI, probably resulting in errors. Further help on its usage with some syntax examples can be found inside the code.

MATLAB release MATLAB 7.1.0 (R14SP3)
Other requirements Tested under Windows XP
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
15 Jul 2007 Sasha Izru

Mr. Panagiotis said: "...something trivial."
It's true! it's very trivial.

12 Sep 2007 M Tareq

useful staff

11 Dec 2007 Karl k

Mr. Panagiotis obviously hasn't had other people use his matlab programs. Submission is exactly what I'm looking for ..... seems like Matlab would incorporate this as an option on msgbox

22 Feb 2008 Chad Webb

Exactly what I was looking for. Thanks!

11 Apr 2008 fhoo chuah chuah

great work! however, may i know how to modify the background color and the message color as well.?

05 Jul 2008 Its Me  
18 Aug 2009 Alejandro Arrizabalaga

Function is OK. However it briefly displays a figure before displaying the message.
I personally preferthe easier option to use msgbox with the OK button not visible:

h=msgbox('Doing something...');
hc=get(h,'Children');
set(hc(2),'Visible','off');

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
gui tools Panagiotis Moulos 22 Oct 2008 09:15:27
example Panagiotis Moulos 22 Oct 2008 09:15:27
message Panagiotis Moulos 22 Oct 2008 09:15:27
message window Panagiotis Moulos 22 Oct 2008 09:15:27
gui Panagiotis Moulos 22 Oct 2008 09:15:27
userdefined Panagiotis Moulos 22 Oct 2008 09:15:27
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com