How to captur up & dpwn key presses and propagate events?
I have my own frame for events and if I write this code:
Code:
eframe:SetScript("OnKeyDown", eframe.OnKeyDown) I need to be able to capture both Down and Up events in my handlers and also propagate both events to the WorldFrame for the game to function normally. Is there a way to do that? Thanks! |
The up handler doesn't fire when you propagate keyboard events. Running the bindings yourself is a protected action, so you can't go that route either.
One thing you might be able to do is register keybinds to issue a click to a button. See SetOverrideBindingClick(). I don't think it can differentiate up and down states. If you mentioned what you're trying to implement, we may provide suggestions for other methods that may work instead. |
Quote:
If it's hard to implement, I can ofc just capture Down event and move when I'm done looting, I guess that will CloseLoot() as well but I wanted to press a button to let the addon know that I want manual loot and then release that button to let it know that it can CloseLoot(). |
You mean ctrl-clicking the mob in the world?
Anyways, just use the normal loot event LOOT_OPENED and check for IsControlKeyDown(), which when pressed/depressed triggers MODIFIER_STATE_CHANGED. To prevent default auto-looting, use the ctrl key as the modifier to avoid autolooting. Something like this perhaps: Lua Code:
|
All times are GMT -6. The time now is 01:51 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI