GUI with no 'close' and 'minimize' buttons

조회 수: 33 (최근 30일)
Mehdi
Mehdi 2014년 5월 12일
답변: Sampath Rachumallu 2020년 5월 11일
I have made a GUI which displays 'Please wait ...' during a computation so it shouldn't be closed or minimized. How can I eliminate the entire bar to prevent unwanted closure or action? Thank you in advance. P.S. I did download WindowAPI but it's not working or I don't know to run it properly. A little help would be great.

답변 (3개)

Sampath Rachumallu
Sampath Rachumallu 2020년 5월 11일
You can check the below link.
You can hide the 'minimise' and 'close' button by setting 'WindowState' property of uifigure to 'full screen'. Here is the code
f = uifigure('WindowState', 'fullscreen');
But when the 'ESC' key is pressed it will come to normal window size having all 'minimise', 'close' buttons etc

Friedrich
Friedrich 2014년 5월 12일
편집: Friedrich 2014년 5월 19일
Hi,
at least on Windows AFAIK no close button is only possible if you disable the complete caption of the window which results in no minimize and maximize buttons too. However no minimize button is possible but you have to stay with the close button. All of this can be done using the Windows API and the SetWindowLong function inside a MEX function.
It migth be easier to implement your own CloseRequestFcn to prevent closing the figure as long the calculation runs. However getting the minimize button to do nothing is not possible from within MATLAB.
UPDATE
Use a small mex (mymex.c):
#include "mex.h"
#include "windows.h"
void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
if (nrhs == 1)
{
long value = GetWindowLong(*(HWND*)mxGetData(prhs[0]), GWL_STYLE);
plhs[0] = mxCreateLogicalScalar(SetWindowLong(*(HWND*)mxGetData(prhs[0]),GWL_STYLE,(int)(value & ~WS_CAPTION)) > 0);
}
}
And call it from MATLAB
plot(1:10);
pause(1);
jFrame = get(handle(gcf),'JavaFrame');
hWnd = int32(jFrame.fHG1Client.getWindow.getHWnd);
mymex(hWnd)

Mehdi
Mehdi 2014년 5월 19일
Hi Friedrich, Thank you for your reply. My system is Windows 8.1. I do want a simple GUI with no 'close', 'minimize or maximize' buttons. I tried the following code and put it in the OutputFcn but nothing happen: handles.output = hObject; guips = get(hObject,'Position'); WindowAPI(hObject,'Position',guips); WindowAPI(hObject,'Clip');
Is there any work around this problem? What's your approach? Thank you in advance.
  댓글 수: 1
Jan
Jan 2016년 2월 17일
The OutputFcn is called, when the GUI function replies an output to the calling function. So better insert this in the CreateFcn.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by