AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Menu not receiving keystrokes

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
abg
Guest





PostPosted: Tue Mar 06, 2007 10:07 am    Post subject: Menu not receiving keystrokes Reply with quote

Hi AHK community!

I occasionally experience the problem that my AHK menus are not receiving keystrokes like up or down or ampersand shortcuts.

Unfortunately, I was not able to create a short script demonstrating this bug deterministically. However, I have noticed that at least one other user is experiencing this:
http://www.autohotkey.com/forum/topic10365.html&highlight=menu+focus

I therefore wanted to ask you guys, if you observe the same thing.

A bit more background: I am using WinXP SP2. I used a custom menu, not TRAY. My first thought was that the menu did not have the focus. I tested this with a script allways displaying the active window's id and it turned out to be the same in cases where the menu behaves properly and incorrectly.
My next thought was a sticky key. But the KeyHistory looks fine.

Does anyone have the same problem or do you even have an idea of how to solve it?
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Mar 06, 2007 4:44 pm    Post subject: Reply with quote

In addition to the topic you linked above, here's a more specific one: Popup menu sometimes doesn't have focus

Here are my current theories for why a popup menu doesn't always get keyboard focus:

1) If your script is running at high process priority, it's possible that the Sleep(0) currently used internally by the program isn't effective. It might need to be increased to Sleep(5) or so.

2) Maybe the MSDN-recommended technique of sending WM_NULL needs to be done even for non-tray menus. If nothing else above helps, I could send a test version to whoever has this issue to see if it helps.

Also, it would help me if you could try activating one of the script's own windows (even its hidden main window) prior to displaying the menu. If that fixes it, it would be valuable info.

Thanks.
Back to top
View user's profile Send private message Send e-mail
abg
Guest





PostPosted: Tue Mar 06, 2007 7:23 pm    Post subject: Reply with quote

Hi Chris,

thank you very much for your quick reply. Actively focussing the hidden AHK main window seems to solve my problem.

Do you have a hint how to best identify the main window? Can usage of
Code:
ahk_class AutoHotkey
cause problems when multiple scripts run simultaneously?

I would rather activate by id or title, but
Code:
temp := A_ScriptFullPath
if (!A_IsCompiled)
  temp .= " - AutoHotkey v" . A_AhkVersion

looks rather complicated to me.
Back to top
Sean



Joined: 12 Feb 2007
Posts: 1323

PostPosted: Wed Mar 07, 2007 2:31 am    Post subject: Reply with quote

Chris wrote:
Also, it would help me if you could try activating one of the script's own windows (even its hidden main window) prior to displaying the menu. If that fixes it, it would be valuable info.

I used exactly the same method in one of my script and it worked well (:no need to do AttachThreadInput myself?):
http://www.autohotkey.com/forum/topic16925.html
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 1323

PostPosted: Wed Mar 07, 2007 4:49 am    Post subject: Reply with quote

abg wrote:
Code:
ahk_class AutoHotkey
cause problems when multiple scripts run simultaneously?

You may use pid then:

Code:
Process, Exist
pidAHK := ErrorLevel

; WinGet, hAHK, ID, ahk_pid %pidAHK%
; WinActivate, ahk_id %hAHK%
WinActivate, ahk_pid %pidAHK%
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group