I am trying to add a message box to serve as an instruction for my user of the GUI I made (Thanks to all your help with the process of making it!!)
I add the following line in my GUI's OpeningFcn:
msgbox('cool stuff', 'instrcution');
However this message box pop up behind my GUI and it very likely not to be seen at all by the user.
Is there a way to make my message box
  • pop up inside my GUI?
  • the user will have to read it and press ok to close it before using the GUI?
Thank you all for great help!

 Respuesta aceptada

Adam
Adam el 3 de Ag. de 2016

1 voto

Move it into the Output_Fcn instead.
In the OpeningFcn it gets created before the GUI creation is completed so when that GUI creation does complete it takes over focus. The OutputFcn is called after GUI creation.

5 comentarios

chlor thanks
chlor thanks el 3 de Ag. de 2016
I did not know this. You are the best Adam!!
Adam
Adam el 3 de Ag. de 2016
I didn't realise it until recently either as I never use the OutputFcn, but at some point I realised what its distinction was when I was playing around with modal GUIs especially from which I wanted outputs to be returned. Returning outputs from a non-modal GUI doesn't work precisely because the OutputFcn is called immediately after creation so unless you have some uiwait behaviour going on it isn't useful for returning the results of user interaction with a GUI.
chlor thanks
chlor thanks el 3 de Ag. de 2016
Editada: chlor thanks el 3 de Ag. de 2016
I am at beginner level of using matlab and am fairly new of using matlab to make GUI, I actually have no idea what a modal GUI is or how is uiwait used... I still have so much more to learn. But mathwork is amazingly helpful and you have been a great teacher guiding me through many of my problems! I really appreciate it.
Adam
Adam el 3 de Ag. de 2016
I'm sure you will find it in the help if you ever need it, but a modal GUI is just one that blocks all other GUIs while you wait for the user to do whatever it is they are expected to do on the GUI (e.g. a dialog box expecting an ok or cancel answer). uiwait is just a command used in conjunction with this to tell the code to wait until the the thing being waited for is closed.
chlor thanks
chlor thanks el 3 de Ag. de 2016
Makes sense, I will take a note of this~

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Scope Variables and Generate Names en Centro de ayuda y File Exchange.

Preguntada:

el 3 de Ag. de 2016

Comentada:

el 3 de Ag. de 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by