HOWTO: Drag and Drop To An Options Menu?
I have an addon that can be configured to sell items by quality (common, uncommon, rare, epic) and/or container (i.e., all items in the selected bags will be sold regardless of quality). All this works perfectly. But now I want to add the ability exclude selected items by dragging (PickupContainerItem()) and dropping the item(s) onto the addon's options' menu and into an exceptions list. All items on the exceptions list will not and cannot be sold.
Since I"m not "moving" an item from one location (e.g., a bag slot) to another (e.g., a bank slot) but to an options menu, how would I accomplish this. Thanks, in advance, for any suggestions. |
I'm not familiar with the "official" way to drag and drop items, but something like this should work:
Lua Code:
This is just a thought process. I don't know if the cursor item clears on any click not on the world frame (which triggers the delete), but if it does, you may need to temporarily cache what the info returns in an OnEnter script then submit the item to your list on the click. |
I would do it on MouseUp
|
Seriously, is it that simple? So on MouseUp the code would
(1) Get the item link held by the cursor (2) Clear the cursor (3) Execute the necessary code to insert the item into the exception list. Do I not need to verify that the mouse is hovering over a specified region of the AddOn Options Dialog? What if the user accidently / inadvertanly releases the button over another slot in another bag? Or in open space (as when deleting an item)? I hope it's as easy as this. Cheers, |
The "frame" in my example is your addon's options frame, or even a specific colored box within your options.
Lua Code:
The code will do nothing if the user doesn't release the item over this specific frame. No need to check for any other location. |
I see. Thanks, Kanegasi, I didn't know that about frame-button semantics.
Cheers, |
All times are GMT -6. The time now is 11:49 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI