mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 07:47:54 +01:00
Root SchemeName can only be set when the popover is not null (#4226)
* Root schema can only be set when the popover is not null * Fix event selection * Remove unnecessary null forgiving --------- Co-authored-by: Daniel Marbach <danielmarbach@users.noreply.github.com> Co-authored-by: Tig <tig@users.noreply.github.com>
This commit is contained in:
@@ -397,10 +397,10 @@ public class MenuBarv2 : Menuv2, IDesignable
|
||||
|
||||
// If the active Application Popover is part of this MenuBar, hide it.
|
||||
if (Application.Popover?.GetActivePopover () is PopoverMenu popoverMenu
|
||||
&& popoverMenu?.Root?.SuperMenuItem?.SuperView == this)
|
||||
&& popoverMenu.Root?.SuperMenuItem?.SuperView == this)
|
||||
{
|
||||
// Logging.Debug ($"{Title} - Calling Application.Popover?.Hide ({popoverMenu.Title})");
|
||||
Application.Popover?.Hide (popoverMenu);
|
||||
Application.Popover.Hide (popoverMenu);
|
||||
}
|
||||
|
||||
if (menuBarItem is null)
|
||||
@@ -416,6 +416,7 @@ public class MenuBarv2 : Menuv2, IDesignable
|
||||
if (menuBarItem.PopoverMenu?.Root is { })
|
||||
{
|
||||
menuBarItem.PopoverMenu.Root.SuperMenuItem = menuBarItem;
|
||||
menuBarItem.PopoverMenu.Root.SchemeName = SchemeName;
|
||||
}
|
||||
|
||||
// Logging.Debug ($"{Title} - \"{menuBarItem.PopoverMenu?.Title}\".MakeVisible");
|
||||
@@ -423,14 +424,15 @@ public class MenuBarv2 : Menuv2, IDesignable
|
||||
|
||||
menuBarItem.Accepting += OnMenuItemAccepted;
|
||||
|
||||
menuBarItem.PopoverMenu!.Root.SchemeName = SchemeName;
|
||||
|
||||
return;
|
||||
|
||||
void OnMenuItemAccepted (object? sender, EventArgs args)
|
||||
{
|
||||
// Logging.Debug ($"{Title} - OnMenuItemAccepted");
|
||||
menuBarItem.PopoverMenu!.VisibleChanged -= OnMenuItemAccepted;
|
||||
if (menuBarItem.PopoverMenu is { })
|
||||
{
|
||||
menuBarItem.PopoverMenu.VisibleChanged -= OnMenuItemAccepted;
|
||||
}
|
||||
|
||||
if (Active && menuBarItem.PopoverMenu is { Visible: false })
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user