need global Firering of MouseClick
1. What i want
=========== Open a Window when clicking a Merchats Item I tried to: ======== WorldFrame:SetScript("OnMouseDown",BuyWin.Check) - it is fired, when I click in teh World and the Merchant, but neither the Items nor the Merchant Window Itself MerchantFrame:RegisterForClicks("LeftButtonDown", "RightButtonDown") - is only Fired, when i click on the window of the Merchant, but not its Items - it would be nice to get this with its childreen My Only solution would be to get each item an own handler frame:RegisterEvent("MERCHANT_SHOW") frame:SetScript("OnMouseDown",Merchant.Init) function Merchant:Init(event,frame) for i=1,frame:GetMerchantNumItems() do .... Prozedur for it ... mergant_item:SetScript("OnMouseDown",BuyWin.Check) end end Is it able to find a smarter procedur ? Well in global world i can get info everywhere with getMouseFocus():GetName(), so it should be able to get known if the MouseButton is pressed independent who i am. |
You might be able to create a frame that covers the whole screen and set it to propagate mouse clicks. (or maybe that was for key presses only?)
What are you wanting to do with this? There might be a different solution. |
There is a trader wehre you can only buy 1 Item and have to confirm another window.
If you want more. it will be a lot of clicks. my code without windows is here: Lua Code:
so I want to do my own window by SHIFT and Mousclick on one Iem EDIT: I have tried an Overlay window: shown: you cannot click anything else anymore hidden: like there is no window and i have also seen WoldFrame is not the Screensize, only a part |
You could hook MerchantItemButton_OnClick or MerchantItemButton_OnModifiedClick.
https://www.townlong-yak.com/framexm...ntFrame.xml#34 https://www.townlong-yak.com/framexm...tFrame.lua#442 https://www.townlong-yak.com/framexm...tFrame.lua#481 |
OK Nice that works!
is it possible to continue with the original procedure ? Answere is Easy: Save the orginal and return it. Here my Solution: lua Code:
Thank you for your fast help, it saved me more hundrets of hours :) Can be Closed! |
You should use hooksecurefunc() whenever possible to prevent spreading taint.
Code:
hooksecurefunc("MerchantItemButton_OnModifiedClick",function() |
@SDPhantom:
hooksecure procedure begins after the function is already finished, so I will have 2 input windows, that is not what i want, but it will help for maybe other functions. For this example of course it works fine. |
If you're looking to disable confirmation windows, you should modify each StaticPopupDialog entry instead.
Lua Code:
If you're complaining about the SplitStackFrame popping up, that's just your choice in using Shift-Click to bypass the confirmation windows as that's used to split stacks when the chat window isn't open. |
Thanks for the nice Code. but that is not what i want for my Addon.
Here my complete Code that works fine, that you see what I mean, SDPhantom There is a trader, wehre you can only buy one item (or the given amount) and you cannot use the SHIFT Click on this trader. I want to enabele this with my own input Window. Lua Code:
|
I didn't realize you're replacing the StackSplitFrame with your own to overcome the stack size limit. The main problem is the API doesn't like being given a number larger than the item's stack size and throws an internal error. One feature of the original StackSplitFrame is that it allows keybinds to pass through. However, this is done by calling a protected function, which will be tricky to preserve.
I believe the best course of action is to repurpose the original StackSplitFrame, but it will probably take heavy modifications to allow purchasing more than the stack limit. I'll see what I can come up with, but I'm not making any promises. |
I went with my own idea and decided to upload it. It ended up being a complete rewrite of Blizzard's StackSplitFrame. I was able to allow keybinds to run by switching frame:SetPropagateKeyboardInput() and I added a couple more control methods as well. It loops the callback to allow processing as many stacks as necessary, though there may be an undocumented limit to how many stacks can be purchased at once.
StackSplitPlus |
All times are GMT -6. The time now is 01:43 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI