ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   AddOn Help/Support (https://www.esoui.com/forums/forumdisplay.php?f=164)
-   -   Drag & Drop with own controls (https://www.esoui.com/forums/showthread.php?t=5575)

@AlphaLemming 01/07/16 05:33 AM

Drag & Drop with own controls
 
Example: Drag an skill or item into a own button control.

Has anyone any idea whether and how that might work ?
InventoryItems have a OnDragStart-event but regular controls do not have any drag (reciveDrag) events.

haggen 01/07/16 06:26 AM

You could use a variable to flag the drag start on MouseDown, and flag the drag stop on MouseUp, and MouseEnter to flag where you're dropping it. No idea if it actually works but that's the breakdown of a Drag+Drop.

circonian 01/07/16 06:50 PM

They have an OnReceiveDrag, here is an example that prints the name of the inventory item or skill & sets the button texture to that item/skill:

XML:
Warning: Spoiler


Lua:
Warning: Spoiler


EDIT: You don't have to do it with xml. You could set the handler with lua also:
Lua Code:
  1. TestAddon_Drag:SetHandler("OnReceiveDrag", TestAddon.OnDragReceive)

@AlphaLemming 01/08/16 02:57 AM

Thanks haggen & circonian, i will try it!

remosito 04/11/22 05:46 AM

Quote:

Originally Posted by haggen (Post 24959)
You could use a variable to flag the drag start on MouseDown, and flag the drag stop on MouseUp, and MouseEnter to flag where you're dropping it. No idea if it actually works but that's the breakdown of a Drag+Drop.


I'll risk the necromancing bounty :eek:

Thanks Haggen!

I just used this method to rearrange the order of displayed cells/lines of information in my GUI window with drag and drop...
(Edit: I am not moving the labels around btw....just what information what label displays..if that makes sense...)
So can confirm this approach works.

(I use OnMouseExit as well to track if we are currently outside allowed target zone. To cancel DandD if dragged outside my window)

It's kinda blind though. As it doesn't have the usual visual help of semitransparent object_on_the_move...

Thinking on simulating it by changing BG color of "cells" the user is moving over (using mouseenter/exit). Plus maybe source "cell" green/red bg depending if current target is valid or not. So user knows it would execute or cancel the drag and drop.

anyway...

was searching for drag and drop and pretty much the only thing I found. Then wondered if it even works...so future searchers will know..it does..

Edit: never tried circonian method... read into a bit but had the fear it was limited to inventory and skill stuff... mine are just labels....

Baertram 04/11/22 03:31 PM

I've implemented that kind of drag&drop into a ZO_SortFilterList (or similar) within LibAddonMenu order list box widget too.

https://www.esoui.com/downloads/info...Boxwidget.html

Using a label at the cursor to show the currently dragged entry but I was also missing some kind of visual "where am I above and where is it inserted between" identifier (if I had not added that by other means, I'm not sure anymore :p).


All times are GMT -6. The time now is 02:35 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI