Keep always on top

88 Ansichten (letzte 30 Tage)
nsbd
nsbd am 19 Mai 2011
Kommentiert: Nasser Hosseini am 23 Feb. 2022
hi guys
I want to, Keep always on top , guide figure ?
Can you give an example ? or link.
  3 Kommentare
Nasser Hosseini
Nasser Hosseini am 16 Feb. 2022
How do you do it with a "msgbox", i.e. keep it always on top? It is still a "figure" and not a "uifigure".
When I try to set 'WindowStyle' as 'alwaysontop', I get error:
>> fig_id = msgbox('test');
>> set(fig_id,'WindowStyle','alwaysontop')
Error using matlab.ui.Figure/set
Functionality not supported with figures created with the figure function.
Adam Danz
Adam Danz am 22 Feb. 2022
Message boxes are generated with regular figures. This property is only available for uifigures. You'll either need to generate your own message box using a uifigure or perhaps use a built-in dialog that uses uifigures (e.g. uialert).

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jan
Jan am 20 Mai 2011
There are a lot of tools for this job in the FEX, e.g. WindowAPI. This tool can use the Windows HWnd handle as input, such that I expect it to work on not-Matlab windows also - as long as you find a method to get the HWnd...
  4 Kommentare
nsbd
nsbd am 20 Mai 2011
setFiguresAlwaysOnTop(true) %always on top
setFiguresAlwaysOnTop(false)
This should be enough :)
nsbd
nsbd am 20 Mai 2011
problem was solved.thks

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (4)

Yoav Livneh
Yoav Livneh am 19 Mai 2011
set(figure_handle,'WindowStyle','modal')
  5 Kommentare
Yoav Livneh
Yoav Livneh am 19 Mai 2011
What I suggested only works within MATLAB. I don't know how to extend it to any window, wait for someone else to answer.
Sorry I couldn't help.
nsbd
nsbd am 19 Mai 2011
:( I wrote a small program for the game.trying.just Would be nice if this property :)

Melden Sie sich an, um zu kommentieren.


DGM
DGM am 22 Feb. 2022
Similar to Jan's suggestion, you can always do the window management with ... your window management tools. Jan's recommendation works in Windows. The following works in Linux.
Attached is a simple function that will set the specified window to be on top. This relies on the use of wmctrl, so you need to have that installed. This works for msgbox windows, regular figure windows, and uifigure windows..
hmb = msgbox('test');
hflg = figure(6);
hfui = uifigure(1);
windowontop(hmb)
windowontop(hflg)
windowontop(hfui)
Of course, you can set other window properties the same way.
  4 Kommentare
Jan
Jan am 23 Feb. 2022
I have no idea, why this is failing, if the demo runs correctly. I've published a new version, which does do no magic tricks anymore to support old Matlab version (HG1, <= R2014b). Now only one C-mex function is compiled. Please try it again with the new version.
Nasser Hosseini
Nasser Hosseini am 23 Feb. 2022
Thank you, Jan! It worked like a charm. :-)

Melden Sie sich an, um zu kommentieren.


nsbd
nsbd am 19 Mai 2011
windowslivemessenger also have the option "always on top"
This Did he can be done?

Shaul Shvimmer
Shaul Shvimmer am 17 Mär. 2020
Hi, I want to inform whoever incounters this challage using MATLAB's App Designer, there's a great solution written by Igor Varfolomeev, from my experiance it works great in MATLAB 2018b and 2019b:
Cheers, and thank you Igor!

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by