Thread Tools Display Modes
01/07/16, 05:33 AM   #1
@AlphaLemming
 
@AlphaLemming's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 122
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.
  Reply With Quote
01/07/16, 06:26 AM   #2
haggen
 
haggen's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2015
Posts: 137
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.
  Reply With Quote
01/07/16, 06:50 PM   #3
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
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)

Last edited by circonian : 01/07/16 at 06:53 PM.
  Reply With Quote
01/08/16, 02:57 AM   #4
@AlphaLemming
 
@AlphaLemming's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 122
Thanks haggen & circonian, i will try it!
  Reply With Quote
04/11/22, 05:46 AM   #5
remosito
AddOn Author - Click to view addons
Join Date: Dec 2019
Posts: 30
Thumbs up

Originally Posted by haggen View Post
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

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....

Last edited by remosito : 04/11/22 at 05:50 AM.
  Reply With Quote
04/11/22, 03:31 PM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,913
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 ).
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » Drag & Drop with own controls

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off