Borrar filtros
Borrar filtros

Close prompt dialog box after hitting OK

4 visualizaciones (últimos 30 días)
monkey_matlab
monkey_matlab el 21 de Abr. de 2016
Respondida: Geoff Hayes el 24 de Abr. de 2016
Hello,
In the function below, I wanted to be able to close the prompt window after hitting the OK button. However, with the code, the window still remains open. Please help me close the prompt window after hitting OK. Thanks.
Here is the code:
function varargout = prompt11(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @prompt11_OpeningFcn, ...
'gui_OutputFcn', @prompt11_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
function prompt11_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
uiwait
function varargout = prompt11_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
function pushbutton1_Callback(hObject, eventdata, handles)
uiresume
function edit1_Callback(hObject, eventdata, handles)
function edit1_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
closereq

Respuesta aceptada

Geoff Hayes
Geoff Hayes el 24 de Abr. de 2016
monkey_matlab - try removing the uiwait and uiresume calls as I don't think that they are needed in this case.
The closereq is unexpected in the edit1_CreateFcn. Doesn't this generate an error message when you try to run your code? If you want to close the GUI when the user presses the OK button, then I would put this command into the pushbutton1_Callback or do
function pushbutton1_Callback(hObject, eventdata, handles)
close(handles.figure1);
assuming that figure1 is the name of your figure/GUI.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by