-
February 14th, 2020, 05:01 #1
dragData in onDragStart() returning true/false/nil
Discussion came up on the discord channel and it was mentioned that one could "edit" the drag data instead of having to fill in the rest (and keep what would normally be there). I tested myself and was unable to get this to work and Moon requested I post it here for later discussions.
Code:<template name="link_audiostop"> <linkcontrol name="audioshortcut"> <script> function onDragStart(button, x, y, draginfo) local node = window.getDatabaseNode(); draginfo.setDescription(DB.getValue(node,"name","") .. " [stop]"); return nil; end </script> <class>urlaudiostop</class> <icon normal="link_audio" pressed="link_audio_down" empty="button_link_empty" /> </linkcontrol> </template>
Code:<template name="link_audiostop"> <linkcontrol name="audioshortcut"> <script> function onDragStart(button, x, y, draginfo) local node = window.getDatabaseNode(); draginfo.setDescription(DB.getValue(node,"name","") .. " [stop]"); draginfo.setShortcutData("urlaudiostop",node.getPath()) draginfo.setIcon("link_audio"); draginfo.setType("shortcut"); return true; end </script> <class>urlaudiostop</class> <icon normal="link_audio" pressed="link_audio_down" empty="button_link_empty" /> </linkcontrol> </template>
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
February 14th, 2020, 17:50 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,558
Just looked at the code. The drag object for default behavior is not created until after scripts are completed. The one passed to onDragStart/onDrag scripts is a "temp" drag object that is only used if you return true/false. So, you'll have to use the full override.
Regards,
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks