Thread: What a drag ;)
-
August 13th, 2020, 04:36 #1
What a drag ;)
So, I decided to look at how dragging works so I could figure out if I do some editing before a node is added.
I tried printing by adding onDrop to the list_text control but when I print, all I can see in debug is the X & Y arguments. The DragData is always "nil"
MoreCore sheet I was using already had a lot of debug code for record_char and through that I saw that setting the onDrop to the sheet instead of control listed stuff. OK - I can see what you do, it isn't really being dropped on the Class - just drop ANYWHERE in that sheet and it gets queried and if applicable is added to right control. I'll have to see if that is it for others, but assuming it is "The Way" (Mandacore!) I can work with that.
But, is there a way to have a control itself only react to a drop where it has access to this non-nil dragData? Looking, it seems onDrop is part of windowcontrol and as I saw, is present in the text_list, it just seems to not have value I need. Just nil.
If I drop it on the edges or in one of the record_char controls, it get's data and it is processed.
Any pointers where to go to understand how to use these?
-
August 13th, 2020, 13:26 #2
I have successfully been using it in the windowclass (since that is what I have seen done in the abilities tab of the 3.5E ruleset).
see charsheet_diseasetracker here.
If I were trying to send different dragged info types to different places, I would parse for it in the windowclass script and send it to different destinations from there.
Conversely, the way the 3.5E abilities tab does it is to allow you to drag it into whichever list you want.Last edited by bmos; August 13th, 2020 at 18:59.
bmos' extensions
he/them
-
August 13th, 2020, 15:48 #3
I’ll look at that, thank you
The thing I found (In OSE)may be like what you did but what had me thinking it was weird is that I could drag a Race shortcut in bottom right hand cas/window and it appears in correct slot on the top middle first line of the sheet.
Now, that’s actually a somewhat cool feature that makes quickly dragging a new char easier. The downside MIGHT be for things like in morecore (& corerpg)where in theory any of those boxes take any list entry ... so not sure how you would direct it exactly without assigning a purpose for each window and maybe looking at a tag like category to know where to put it. Which may be enough for me except then >I< have to decide what goes where vs original idea of letting users design layout according to their needs (since morecore uses pretty generic boxes o rolls for much of its work)
It will look at this and see what can do with it later after work. The main thing is users can drag now fine to those controls - I just Would have loved to have access to the drag-accept on those controls because I’d like to control how SOME of them get inserted (tag name for referencing) I think I’ll be fine with just the main ones being “fixed” and rest can have any of and work.
-
August 13th, 2020, 16:41 #4
onDragStart is a great function to call when you wish to inject information or even change the data contained in the drag. You can set the information before it arrives.
As for the dropping behavior, you might want to check out CharManager (5E/campaign/scripts/manager_char.lua). This has a great breakdown on how the 5E character sheet checks the drag sClass and then branches to decide what to do with it based on that. The script file handles items, race, class, and so on.Dominic Morta
Ruleset Developer
Smiteworks
How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it
How to provide an Unity Connection issue?-Connection Issues and What to Provide
Unity Updater issue?-Updater Issues
Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained
Comcast or Cox ISP User?-Comcast XFinity and Cox Users
Have a suggestion?-Feature Request
-
August 13th, 2020, 23:41 #5
After dinner, finally going to make some time. How much, depends on how much I recuperate after dinner. Except for 2 hours at PT & lunch, from 9:30am until 6:20 I was in a Zoom design/spec meeting. Soooo over it ;(
--- Meant to ask - this onDragStart sounds interesting and possibly all I would want. Is it possible to intercept this on a window created from sidebar? I need to look at Morecore to find out who is in charge of the "Rolls" window and see if can hook onDrag start to it!
-
August 14th, 2020, 00:03 #6
In particular, this is the window I would be starting the drag from - ignore most of what I put in there - was for testing
Attachment 38536
Finally, dinner awaits. Have 2.5 hours before my game tonight but will try to get Debug.console() messages in tonight to help me find the area to work on.
-
August 14th, 2020, 00:56 #7
Please do a search of unpacked CoreRPG, 3.5e, and 5E for onDragStart for examples and see how you can inject information into the draginfo. 3.5e would hold the best results to what I eluded to earlier with handling various different sClass types and how the window/frame would interpret the drop.
Dominic Morta
Ruleset Developer
Smiteworks
How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it
How to provide an Unity Connection issue?-Connection Issues and What to Provide
Unity Updater issue?-Updater Issues
Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained
Comcast or Cox ISP User?-Comcast XFinity and Cox Users
Have a suggestion?-Feature Request
-
August 14th, 2020, 01:47 #8
I got what you meant, what I meant to ask is where I can find what handles/manages the window I posted the pic of. So I could try putting an onDragStart there. I took one try/guess “record_cas.xml” windowclass and put an “I’m here” debug print. But it didn’t output so it was wrong place to put the handler.
I’m actually so sleepy going to take a nap before my game in n 1:15 hours and try tomorrow. PT days plus the meeting wiped me. Thanks though, your info on how to look at how it is used will certainly help me out!
I am just trying to identify the durned PLACE to put it
-
August 14th, 2020, 01:59 #9
Sorry, misunderstood. The window you displayed in the attachment is the masterindex window for MoreCore Roll records. You can find the masterindex in CoreRPG under the campaign. The related lua files also appear under the campaign script folder.
Dominic Morta
Ruleset Developer
Smiteworks
How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it
How to provide an Unity Connection issue?-Connection Issues and What to Provide
Unity Updater issue?-Updater Issues
Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained
Comcast or Cox ISP User?-Comcast XFinity and Cox Users
Have a suggestion?-Feature Request
-
August 15th, 2020, 03:03 #10
While just firing "bracket shots", I added the following to materindexitem_window.lua
Oddly (to me only probably) I only had luck with "onDrop" printing if I dragged from char sheet to this window - which is opposite of what I am trying to do.
I figure I got the right control since when I drop something into it - it prints out. But when I try dragging FROM it, nothing prints of the methods below.
That said - I am asking merely to LEARN stuff since I found out by trying the reverse (which didn't help me do what want but let me test if could do it if got right direction) and found out that the shortcut being dragged DOES keep the original name and it seems the numberification to XXX.ID-00001, 00002, etc is done AFTER onDrop so I cannot "save" it using an ID of my choice if I let it get done via automatic onDrop code. Perhaps. could intercept onDrop - then collect the node info and tell onDrop not to do default behavior and manually int he code insert
Code I added, none but onDrop, TO this window of course, triggers:
Code:function onDragStart(button, x, y, dragdata) Debug.console("onDragStart:", dragdata) end function onDrag(button, x, y, dragdata) Debug.console("onDrag:", dragdata) end function onDragEnd(dragdata) Debug.console("onDragEnd:", dragdata) end function onDrop(x, y, dragdata) Debug.console("onDrop:", dragdata) end
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks