Posts: 1,031
Threads: 246
Joined: Jul 2022
#34
I've set the Recipe panel as a floating panel, but it always stays on top. Is there a way to unpin it?
Posts: 12,071
Threads: 140
Joined: Dec 2002
04-27-2024, 04:30 AM
(This post was last modified: 04-27-2024, 04:35 AM by Gintaras.)
// script "LA floating panel make unowned.cs"
LA.FloatingPanelMakeUnowned("Recipe");
//LA.FloatingPanelMakeUnowned("*"); //all
static class LA {
/// <summary>
/// Finds a LA floating panel and makes it not owned by the main LA window.
/// </summary>
/// <param name="name">Panel name. Or <c>"*"</c> for "all panels".</param>
/// <remarks>
/// Then the panel is not always on top of the main LA window. It is visible when the main window is minimized. It can be maximized and minimized, and has a taskbar button.
/// </remarks>
public static void FloatingPanelMakeUnowned(string name) {
foreach (var w in wnd.findAll("Au.Editor - " + name, "HwndWrapper[Au.Editor;*", default, WFlags.CloakedToo, also: o => o.HasExStyle(WSE.TOOLWINDOW) && !o.HasStyle(WS.CAPTION))) {
FloatingPanelMakeUnowned(w);
}
}
/// <summary>
/// Makes a LA floating panel not owned by the main LA window.
/// </summary>
/// <param name="w">Floating panel window.</param>
public static void FloatingPanelMakeUnowned(wnd w) {
WndUtil.SetOwnerWindow(w, default);
w.SetExStyle(WSE.TOOLWINDOW, WSFlags.Remove);
w.SetStyle(WS.CAPTION | WS.MAXIMIZEBOX | WS.MINIMIZEBOX | WS.SYSMENU, WSFlags.Add | WSFlags.UpdateNonclient);
api.EnableMenuItem(api.GetSystemMenu(w, false), api.SC_CLOSE, api.MF_GRAYED);
w.TaskbarButton.Add();
}
unsafe class api : NativeApi {
[DllImport("user32.dll")]
internal static extern IntPtr GetSystemMenu(wnd hWnd, bool bRevert);
[DllImport("user32.dll")]
internal static extern bool EnableMenuItem(IntPtr hMenu, uint uIDEnableItem, uint uEnable);
internal const uint SC_CLOSE = 0xF060;
internal const uint MF_GRAYED = 0x1;
}
}
Posts: 1,031
Threads: 246
Joined: Jul 2022
Thank you.
It would be better if this feature could be added to the right-click menu.
https://i.ibb.co/qYRzRD7/pic.png
Posts: 12,071
Threads: 140
Joined: Dec 2002
In new LA this option is in the context menu of all panels. Right-click caption.