phantomwhale
October 13th, 2013, 13:12
There is some code in my ruleset that need to do different things for the same "type" of data, depending on where it comes from. So, for instance, an NPC dragged from the GM's personality list is treated different to an NPC dragged from a PC's ally list. Both point to an "NPC" object, and both come from lists of windows that have a window reference control to open an NPC window for that data, but I would like to handle them differently where they are dropped. In this case, the combat tracker would like to copy over a lot of data (GM NPC) or link to a bunch of data (PC Ally). In the former case, the data is acting like a template, copying over values for a new instance of that NPC, in the latter the data being dragged is for the very same instance of the NPC - a copy of the ally is NOT made.
Hope that's clear ! Anyways... my thoughts on this were that it would be handled via different dragdata types. Have the combat tracker list of NPCs handle an "ally" type different to how it currently handles the general "npc" type. Right now, it needs to look at the name of the database node that the NPC came from, and deduces anything that originated from the "charsheet.###" nodes must be an ally, but I'd rather not build that level of DB knowledge into the windows.
But my attempts to change the dragdata of a window reference control have so far failed - they always seem to still just be a "shortcut" type dragdata node when they get dropped, and when I look at the dragdata object in an onDragStart() method, the dragdata object has type "none", as if I am being given a dummy object, which no matter what I call on it gets thrown away, and a shortcut dragdata object still being created.
Can someone confirm if this is the case ? And if window reference control's drag behaviour is locked down ? Equally interested to see if this approach is a wise one or not, perhaps there is a better way of doing this that I haven't thought of ? I'd rather not make my own genericcontrol to do the drag and drop, and I'd like the control to still have all the behaviour of a window reference control (e.g. click on it to open a window of the appropriate class and database node)
Regards,
Ben (-PW-)
Hope that's clear ! Anyways... my thoughts on this were that it would be handled via different dragdata types. Have the combat tracker list of NPCs handle an "ally" type different to how it currently handles the general "npc" type. Right now, it needs to look at the name of the database node that the NPC came from, and deduces anything that originated from the "charsheet.###" nodes must be an ally, but I'd rather not build that level of DB knowledge into the windows.
But my attempts to change the dragdata of a window reference control have so far failed - they always seem to still just be a "shortcut" type dragdata node when they get dropped, and when I look at the dragdata object in an onDragStart() method, the dragdata object has type "none", as if I am being given a dummy object, which no matter what I call on it gets thrown away, and a shortcut dragdata object still being created.
Can someone confirm if this is the case ? And if window reference control's drag behaviour is locked down ? Equally interested to see if this approach is a wise one or not, perhaps there is a better way of doing this that I haven't thought of ? I'd rather not make my own genericcontrol to do the drag and drop, and I'd like the control to still have all the behaviour of a window reference control (e.g. click on it to open a window of the appropriate class and database node)
Regards,
Ben (-PW-)