Starfinder Playlist
  1. #1

    Join Date
    Feb 2006
    Location
    Fairfax County, Virginia
    Posts
    499

    Drag-and-drop spell entries

    I've been working on a modified CRS for d20, and decided to implement dual spell lists where one is for all known spells and the other is for prepared spells. The intention is that you should be able to drag spells from the known spell list over to the prepared spell list. Aside from that, the spell lists are like the one on the default CRS, using the windowlist control. Works great.

    However, I haven't been able to figure out how to get the dragging and dropping to work. I figured out that you need at least a dummy control (like a windowopencontrol) on the nested window in order to grab hold of it. But when I drop the item, it doesn't get added.

    Here's the relevant portions of my code:

    Code:
    	<windowclass name="charsheet_spellentryk">
    		<frame name="charsheet_spellentryk" />
    		<datasource name="spellk" />
    		<defaultsize width="350" height="40" />
    		<sheetdata>
    			<windowopencontrol>
    				<bounds rect="3,3,35,35" />
    			</windowopencontrol>
    			<stringcontrol name="name">
    			...
    			</stringcontrol>
    		</sheetdata>
    	</windowclass>
    Code:
    	<windowclass name="charsheet_spellentryp">
    		<frame name="charsheet_spellentryp" />
    		<datasource name="spellp" />
    		<defaultsize width="350" height="40" />
    		<sheetdata>
    			<windowopencontrol>
    				<bounds rect="3,3,35,35" />
    			</windowopencontrol>
    			<stringcontrol name="name">
    			...
    			</stringcontrol>
    		</sheetdata>
    	</windowclass>
    Code:
    	<windowclass name="charsheet_spells">
    		<frame name="charsheet_spells" />
    		<datasource name="charsheet" />
    		<defaultsize width="720" height="720" />
    		<sheetdata>
    			<windowlist class="charsheet_spellentryk" name="spellsknown">
    				<allowcreate />
    				<allowdelete />
    				<nestdata />
    				<bounds rect="8,45,350,520" />
    				<sort fields="name,level" />
    				<acceptdrop class="charsheet_spellentryp" fields="name,level,school,savedc,prepared,shortdescription" />
    				<acceptdrop class="spelldesc" fields="name,level,shortdescription" />
    			</windowlist>
    			<scroller>
    			...
    			</scroller>
    
    			<windowlist class="charsheet_spellentryp" name="spelllist">
    				<allowcreate />
    				<allowdelete />
    				<nestdata />
    				<bounds rect="362,45,350,520" />
    				<sort fields="name,level" />
    				<acceptdrop class="charsheet_spellentryk" fields="name,level,school,savedc,prepared,shortdescription" />
    				<acceptdrop class="spelldesc" fields="name,level,shortdescription" />
    			</windowlist>
    			<scroller>
    			...
    			</scroller>
    		</sheetdata>
    	</windowclass>
    Any ideas on this? I looked through the default d20_reference.xml for clues, since the default CRS supports dragging and dropping from the spell descriptions in the D20 reference, but I didn't see anything special there that would make a difference. Might be something subtle, though.

    Thanks much!

  2. #2
    Hmm, I did something similar with inventory/treasure recently (they are on separate pages and I added a small windowlist control to allow drag-drop from one list to the other)
    Can't see anything obvious in the xml. Will have another look at my ruleset after work today.

  3. #3

    Join Date
    Feb 2006
    Location
    Fairfax County, Virginia
    Posts
    499
    Thanks, much appreciated

  4. #4
    Thats a great idea! Let us know if you get that working.

  5. #5
    I think the problem lies in the windowopen node. It needs to have a class name. Without it FG doesn't know what you are dragging.

    <windowclass name="charsheet_spellentryp">
    <frame name="charsheet_spellentryp" />
    <datasource name="spellp" />
    <defaultsize width="350" height="40" />
    <sheetdata>
    <windowopencontrol>
    <bounds rect="3,3,35,35" />
    <class name="charsheet_spellentryp" />
    </windowopencontrol>
    <stringcontrol name="name">
    ...
    </stringcontrol>
    </sheetdata>
    </windowclass>

    Now there is one side-effect: if you drag a spell onto the FG desktop you get a single spell entry on the desktop. Not sure how to avoid that...maybe by defining a duplicate of the charsheet_spellentryp class with invisible fields? no that doesn't sound right...hmm, anyone know how to prevent a windowopen control from being dragged to the desktop?

  6. #6

    Join Date
    Feb 2006
    Location
    Fairfax County, Virginia
    Posts
    499
    hmm, anyone know how to prevent a windowopen control from being dragged to the desktop?

    Beats the heck outta me, but you know what? I actually think it's a good thing being able to drag the spells to the desktop

    Thanks much for the help! I still have a few bugs here and there, but I'm planning on releasing my modified CRS here on the forums before too long.

    Edit: Doh! I just noticed that the spell entries on the desktop end up both empty and uneditable, so I guess it's not that useful after all
    Last edited by Dachannien; March 18th, 2006 at 17:42.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Dungeons & Dragons 2024 Core Rulebooks Pre-Order

Log in

Log in