Menu is obscured by the top window

Ask for help, how to use AHK_H, etc.
crocodile
Posts: 116
Joined: 28 Dec 2020, 13:41

Menu is obscured by the top window

Post by crocodile » 10 Jul 2023, 01:52

Today I updated to 2.0.4, and I found that a menu that is displayed above the top window is not displayed anymore, it is blocked by this top window. In the version before 2.0.4, the menu was always displayed normally.
Is this a bug or a new feature that I didn't notice?

crocodile
Posts: 116
Joined: 28 Dec 2020, 13:41

Re: Menu is obscured by the top window

Post by crocodile » 10 Jul 2023, 05:16

Sorry, this problem only occurs with AutoHotkey-H v2.0.4 maintained by thqby.
@thqby

Code: Select all

t:=gui()
t.show("x200 y200 w200 h200")
WinSetAlwaysOnTop 1, t.hwnd
MyMenu := Menu()
MyMenu.Add "Item 1", MenuHandler
MyMenu.Add "Item 2", MenuHandler
MyMenu.Add
MyMenu.Show(200, 200)
MenuHandler(Item, *) {
    MsgBox "You selected " Item
}

MsgBox

[Mod action: Moved topic from the main section to the AHK_H section.]

User avatar
thqby
Posts: 560
Joined: 16 Apr 2021, 11:18
Contact:

Re: Menu is obscured by the top window

Post by thqby » 10 Jul 2023, 08:41

I also merged v2.1-alpha.1, and @lexikos added code so that scripts can display menus without blocking, which also caused this problem.

crocodile
Posts: 116
Joined: 28 Dec 2020, 13:41

Re: Menu is obscured by the top window

Post by crocodile » 10 Jul 2023, 08:51

Indeed, this problem also occurs in L2.1.
So should this topic be converted to the "Bug Reports" section?

crocodile
Posts: 116
Joined: 28 Dec 2020, 13:41

Re: Menu is obscured by the top window

Post by crocodile » 02 Aug 2023, 22:47

@thqby This issue doesn't seem to be getting fixed anytime soon, can you fix it at ahk-h?

User avatar
thqby
Posts: 560
Joined: 16 Apr 2021, 11:18
Contact:

Re: Menu is obscured by the top window

Post by thqby » 03 Aug 2023, 06:29

Code: Select all

t:=gui()
t.show("x200 y200 w200 h200")
WinSetAlwaysOnTop 1, t.hwnd
MyMenu := Menu()
MyMenu.Add "Item 1", MenuHandler
MyMenu.Add "Item 2", MenuHandler
MyMenu.Add
WinSetAlwaysOnTop 1, A_ScriptHwnd
MyMenu.Show(200, 200)
MenuHandler(Item, *) {
    MsgBox "You selected " Item
}

crocodile
Posts: 116
Joined: 28 Dec 2020, 13:41

Re: Menu is obscured by the top window

Post by crocodile » 03 Aug 2023, 17:02

I've modified it this way, but I'm using MyMenu.Handle, which has no effect. Thanks.

User avatar
thqby
Posts: 560
Joined: 16 Apr 2021, 11:18
Contact:

Re: Menu is obscured by the top window

Post by thqby » 04 Aug 2023, 04:33

crocodile wrote:
03 Aug 2023, 17:02
but I'm using MyMenu.Handle, which has no effect.
What do you mean?

crocodile
Posts: 116
Joined: 28 Dec 2020, 13:41

Re: Menu is obscured by the top window

Post by crocodile » 04 Aug 2023, 06:13

Your method works.
I have done a similar modification, but I used "WinSetAlwaysOnTop 1, MyMenu.Handle" and it had no effect.

crocodile
Posts: 116
Joined: 28 Dec 2020, 13:41

Re: Menu is obscured by the top window

Post by crocodile » 10 Nov 2023, 09:46

@thqby
Although this issue was fixed in v2.1-alpha.2, I found it to be incomplete.
If the window is topped, but not the active window. The menu will still be obscured.
I'm using Hv2.0.10 and I'm not sure if this is the same problem in L2 or H2.1.

User avatar
thqby
Posts: 560
Joined: 16 Apr 2021, 11:18
Contact:

Re: Menu is obscured by the top window

Post by thqby » 11 Nov 2023, 03:13

@crocodile
Is there any test code?

crocodile
Posts: 116
Joined: 28 Dec 2020, 13:41

Re: Menu is obscured by the top window

Post by crocodile » 11 Nov 2023, 04:10

Code: Select all

t:=gui()
t.show("x200 y200 w200 h200")
WinSetAlwaysOnTop 1, t.hwnd
MyMenu := Menu()
MyMenu.Add "Item 1", MenuHandler
MyMenu.Add "Item 2", MenuHandler
MyMenu.Add
return
f1::
{
;Make sure the gui is not the active window
t.getpos(&x, &y)
MyMenu.Show(x, y)
}

MenuHandler(Item, *) {
    MsgBox "You selected " Item
}

User avatar
thqby
Posts: 560
Joined: 16 Apr 2021, 11:18
Contact:

Re: Menu is obscured by the top window

Post by thqby » 11 Nov 2023, 05:53

The issue cannot be reproduced, but there is an issue where the input focus is not on the menu.

crocodile
Posts: 116
Joined: 28 Dec 2020, 13:41

Re: Menu is obscured by the top window

Post by crocodile » 11 Nov 2023, 06:28

Yes, in the latest H2.0.10 I didn't reproduce the problem. Sorry the H2.0.10 I'm using seems to be some older version. Maybe H should use a version marker somewhere. :)

User avatar
thqby
Posts: 560
Joined: 16 Apr 2021, 11:18
Contact:

Re: Menu is obscured by the top window

Post by thqby » 11 Nov 2023, 06:47

This will cause too many release tags. :oops:
So only the file was updated.

Post Reply

Return to “Ask for Help”