Recent

Author Topic: TMainMenu: Hotkeys active with visible is false  (Read 2174 times)

Milsa

  • Sr. Member
  • ****
  • Posts: 326
TMainMenu: Hotkeys active with visible is false
« on: March 02, 2022, 02:27:02 pm »
I have project of emulator. Project has TMainMenu and image of computer output. If image is fullscreen, main menu is visible. I need hide main menu. If I set MainMenu.Visible := False, then hotkeys in menu is inactive.

Does exist an option to activate hotkeys in main menu with hidden / transparent main menu?

I don't want to do duplicate keyboard shortcut handling.
I work with Lazarus 2.2.2, FPC 3.2.2, date 2022-05-15
This information is actual to: 28st Dec 2022

AlexTP

  • Hero Member
  • *****
  • Posts: 2566
    • UVviewsoft
Re: TMainMenu: Hotkeys active with visible is false
« Reply #1 on: March 02, 2022, 04:17:07 pm »
One have to check it in Delphi - does it disable hotkeys when menu Visible=false?

Milsa

  • Sr. Member
  • ****
  • Posts: 326
Re: TMainMenu: Hotkeys active with visible is false
« Reply #2 on: March 02, 2022, 04:27:09 pm »
I do not know. I have Lazarus only. But I need menu hotkeys active when menu is invisible.
I work with Lazarus 2.2.2, FPC 3.2.2, date 2022-05-15
This information is actual to: 28st Dec 2022

Zvoni

  • Hero Member
  • *****
  • Posts: 2966
Re: TMainMenu: Hotkeys active with visible is false
« Reply #3 on: March 02, 2022, 04:39:30 pm »
Cannot confirm (FPC322-32Bit/Laz220-32Bit/Win10-64Bit)

Though something weird: Invisible MenuItem with ShortCut, after pressing ShortCut, Lazarus jumps into Debug-Mode, and shows the Assembler-Window (as if on Breakpoint)
Hit on F8, and OnClick-Event-Handler for invisible MenuItem gets processed
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Milsa

  • Sr. Member
  • ****
  • Posts: 326
Re: TMainMenu: Hotkeys active with visible is false
« Reply #4 on: March 02, 2022, 04:42:00 pm »
It's an older project. I need to find out what exactly is causing the problem there. I'm trying a clean project for verification.

TMainMenu has not property Visible.
I work with Lazarus 2.2.2, FPC 3.2.2, date 2022-05-15
This information is actual to: 28st Dec 2022

Zvoni

  • Hero Member
  • *****
  • Posts: 2966
Re: TMainMenu: Hotkeys active with visible is false
« Reply #5 on: March 02, 2022, 04:45:56 pm »
It's an older project. I need to find out what exactly is causing the problem there. I'm trying a clean project for verification.

TMainMenu has not property Visible.
No, you have to add a TMenuItem (best with Menu-Editor).
TMenuItem has Visible-Property

TMainMenu is only the uppermost Container for the Menu-Tree
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Milsa

  • Sr. Member
  • ****
  • Posts: 326
Re: TMainMenu: Hotkeys active with visible is false
« Reply #6 on: March 02, 2022, 04:46:25 pm »
Please accept my apologies. My question should have been different: Why is there no Visible property in TMainMenu to quickly hide menus so that keyboard shortcuts work?

I'm looking at the project right now and I have to remove the menu in a temporary variable there because I can't hide it.
I work with Lazarus 2.2.2, FPC 3.2.2, date 2022-05-15
This information is actual to: 28st Dec 2022

Milsa

  • Sr. Member
  • ****
  • Posts: 326
Re: TMainMenu: Hotkeys active with visible is false
« Reply #7 on: March 02, 2022, 04:47:39 pm »
It's an older project. I need to find out what exactly is causing the problem there. I'm trying a clean project for verification.

TMainMenu has not property Visible.
No, you have to add a TMenuItem (best with Menu-Editor).
TMenuItem has Visible-Property
Does exist option to hide all menu no every item?
I work with Lazarus 2.2.2, FPC 3.2.2, date 2022-05-15
This information is actual to: 28st Dec 2022

Zvoni

  • Hero Member
  • *****
  • Posts: 2966
Re: TMainMenu: Hotkeys active with visible is false
« Reply #8 on: March 02, 2022, 04:48:34 pm »
Please accept my apologies. My question should have been different: Why is there no Visible property in TMainMenu to quickly hide menus so that keyboard shortcuts work?

I'm looking at the project right now and I have to remove the menu in a temporary variable there because I can't hide it.

TMainMenu is a Non-Visual component and is just a Container.
Everything you see in a MenuBar are TMenuItems
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Milsa

  • Sr. Member
  • ****
  • Posts: 326
Re: TMainMenu: Hotkeys active with visible is false
« Reply #9 on: March 02, 2022, 05:02:55 pm »
So, the only option is to hide all primary MenuItem?
I work with Lazarus 2.2.2, FPC 3.2.2, date 2022-05-15
This information is actual to: 28st Dec 2022

Milsa

  • Sr. Member
  • ****
  • Posts: 326
Re: TMainMenu: Hotkeys active with visible is false
« Reply #10 on: March 02, 2022, 05:08:16 pm »
Is this the simplest solution? Set the Tag to 1 for the root MenuItem and hide them in the loop?
I work with Lazarus 2.2.2, FPC 3.2.2, date 2022-05-15
This information is actual to: 28st Dec 2022

AlexTP

  • Hero Member
  • *****
  • Posts: 2566
    • UVviewsoft
Re: TMainMenu: Hotkeys active with visible is false
« Reply #11 on: March 02, 2022, 05:15:03 pm »
Try this hack:
MainMenu1.Parent:= nil; //to hide the menubar

balazsszekely

  • Guest
Re: TMainMenu: Hotkeys active with visible is false
« Reply #12 on: March 02, 2022, 05:21:55 pm »
@Milsa
You can achieve what are you after by creating different actions using a TActionList, then link each menu item to it's equivalent action. When you wish to hide the main menu, just do the following:
Code: Pascal  [Select][+][-]
  1. Form1.Menu := nil;
The shortcut keys will still work via the ActionList.

Milsa

  • Sr. Member
  • ****
  • Posts: 326
Re: TMainMenu: Hotkeys active with visible is false
« Reply #13 on: March 02, 2022, 05:22:44 pm »
Try this hack:
MainMenu1.Parent:= nil; //to hide the menubar
This is no good. Menu will be not work.
I work with Lazarus 2.2.2, FPC 3.2.2, date 2022-05-15
This information is actual to: 28st Dec 2022

Milsa

  • Sr. Member
  • ****
  • Posts: 326
Re: TMainMenu: Hotkeys active with visible is false
« Reply #14 on: March 02, 2022, 05:26:09 pm »
Try this hack:
MainMenu1.Parent:= nil; //to hide the menubar
This is no good. Menu will be not work.
That's a duplication of hotkeys, isn't it?

I will try to hide MenuItems with Tag 1 (root element).
I work with Lazarus 2.2.2, FPC 3.2.2, date 2022-05-15
This information is actual to: 28st Dec 2022

 

TinyPortal © 2005-2018