Is there any way to get the uigetfile panel to be centered in the monitor when it first comes up????

조회 수: 8 (최근 30일)
I use the MATLAB function uigetfile to read in the path and name of a file. How do I get that panel to appear in the center of the screen. It always pops up in the upper left corner of the screen.
Note, this code must work with the compiler also.
Thanks Bob
  댓글 수: 8
Walter Roberson
Walter Roberson 2022년 3월 17일
Having the functionality work sometime is better than not having it work at all.
However, as you are working with Windows, do not be astonished if it suddenly stops working with some KB*, or if it works differently depending which Creators Edition or half-year Windows update, or whatever.
Matt J
Matt J 2022년 3월 17일
편집: Matt J 2022년 3월 17일
So for now, "Operating-System Dependent Behavior" is best for me. It works.
I'm on a Windows 10 OS and, as I said, the method doesn't work on my machine. I think you will see that if you manually drag the uigetfile window to some random location on the screen and then re-run your code. In Windows, the uigetfile windows will always open where it was last positioned.

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

답변 (2개)

Walter Roberson
Walter Roberson 2022년 3월 15일
No, there is no control over that.
If you are not using a deployed app, then MATLAB runs a java method to start an operating-system native file picker. There are no user-level controls over where that operating-system facility will appear.

Matt J
Matt J 2022년 3월 15일
If you drag the uigetfile window to the location where you want it then, the next time you call uigetfile, it will open in that position, even if it's in a later Matlab session. I don't know if something similar would hold true for a deployed app.

카테고리

Help CenterFile Exchange에서 Dialog Boxes에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by