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