DICE PACKS BUNDLE
  1. #1
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075

    Odd DragNDrop problem

    I have mainly developed under FGC. Recently once I updated sidebars and saw that my extension works with MoreCore 1.61+ fine I switched to FGU and my MACOS to code in instead of. FGC on my Parallels VM (where I'd diff and move changes to "real" MAC dir to do git commits from - developing natively in MAC is so much cleaner. But I held off thinking originally that I'd have to do a lot to get it under FGU (untrue))

    So I do not know when it stopped working or if it was always wrong in my extension. I have tons of saved info in git including various tagged test releases I send to Michael Potter for him to look at (under FGC until last 2). So I can get back my stuff but to recreate the pre-update FGC environ would be a pain and unless I find a literal dir copy (I might) it would be fruitless.

    I know the issue is in MY code. I just cannot imagine what I did to break it in ONLY FGU.

    Recreate:
    1. Create a character sheet (blank or from my Pregen (ie presetup with rolls char sheet))
    2. Create a new roll using the Rolls sidebar via + >NOT directly on the sheet, that works< .(eliminates issues with my data MOD file.) Anything really including just a name with no dice string.
    3. Drag from Rolls to any sheet CLIList box.

    It is not added.
    If I do with EXACT same .ext on latest FGC, it drops on sheet correctly. So do all my MOD file Rolls.


    I do not know anything I changed (other than modifying the CLIList to support querying an "alt_sort_order" field if present to allow overriding of alpha sort - anal me likes SIWDCCh and d4,d6,d8,10,d12,d20 in the list orders) that can do this.

    I could not find any onDrop() for the CAS objects but I am bad at coding this stuff - may have missed it?
    Or, it could be the "accepts" entry in XML is some flag to automagically merge it in on drops via the FG API. Dunno.

    Moon... I really hesitated trying to ask you because it could be SO MUCH on my end that causes it. But maybe anything you might opine on that is different between FGC and FGU that MoreCore's CAS drag/drop may be vulnerable to something I did?

    If I use vanilla MC, I can drag/drop fine. So it is me.

  2. #2
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    So... since it worked on MoreCoreData tab, I realized I hadn't "customized" that tab yet.
    I did so on MoreCore via "join"


    For example, the is an excerpt from MoreCore:
    Code:
    <root>
    <!-- New WindowClass "charsheet_more" -->
    	<windowclass name="charsheet_more">
    		<script>
    			function onInit()
    				self.onSizeChanged = resizeFrames;
    			end
    
    			function resizeFrames(sourceWindow)
    				local nWidth,nHeight = getSize();
    				combatframe.setStaticBounds((nWidth/3*2)-15, 45, (nWidth/3)-15, 170)
    				attackframe.setStaticBounds(15, 0, (nWidth*2/3)-30, 215)
    				cas2.setStaticBounds((nWidth/3), 215, (nWidth/3)-15, 240)
    			end
    		</script>
    		<sheetdata>
    ...
    ...
    			<frame_char_switch_rolls name="cas3a">
    				<anchored>
    					<top parent="cas2" anchor="bottom" />
    					<left parent="cas2" anchor="right" />
    					<right parent="" anchor="right" offset="-29" />
    					<bottom parent="" anchor="bottom" offset="-1" />
    				</anchored>
    <!--				<anchored to="cas2a" position="right" offset="">
    					<right parent="" anchor="right" offset="-29" />
    					<!{1}**<bottom anchor="center" offset="60" />**{1}>
    				</anchored>	-->
    				<!--<bounds>335,435,-29,-1</bounds>-->
    			</frame_char_switch_rolls>
    		<string_useredit_bold name="cas3a_label" source="cas3a_label">
    				<anchored to="cas3a" />
    				<default>Focuses</default>
    				<tooltip textres="label_editable_stats" />
    		</string_useredit_bold>
    <!-- Code for draggable string rolls -->
    <list_text name="cliroller3a">
    				<anchored to="cas3a">
    					<left offset="10" />
    					<top offset="30" />
    					<right offset="-4" />
    					<bottom offset="-10" />
    				</anchored>
    				<newfocus>name</newfocus>
    				<datasource>.clilist3a</datasource>
    				<class>cli_rolls</class>
    				<acceptdrop>
    					<class>cas</class>
    					<class>trackers</class>
    					<class>referencetextwide</class>
    					<field>*</field>
    				</acceptdrop>
    			</list_text>
    			<scrollbar_rolls name="scroll_3a">
    				<anchored to="cas3a" />
    				<target>cliroller3a</target>
    			</scrollbar_rolls>

    From my ruleset:
    Code:
    <root>
    	<!-- New WindowClass "charsheet_more" -->
    	<windowclass name="charsheet_more" merge="join">
    		<script>
    			function onInit()
    				self.onSizeChanged = resizeFrames
    
    				
    				local nodeChar = getDatabaseNode()
    				Character.storeInitialConstitutionModifier(nodeChar)
    							
    				CharacterManagerSWWB.initDescendingACFields(nodeChar)
    				CharacterManagerSWWB.initAscendingACFields(nodeChar)
    				CharacterManagerSWWB.calcItemArmorClass(nodeChar)
    				CharacterManagerSWWB.registerAttributesWatcher(nodeChar)
    				CharacterManagerSWWB.registerXPModWatcher(getDatabaseNode())
    
    				OptionsManager.registerCallback("AlternateRule_UseAscendingAC", onARUseAscendingACChanged)
    				OptionsManager.registerCallback("AlternateRule_UniversalAttributeAverageRange", onARUniversalAttributeAverageRangeChanged)
    				OptionsManager.registerCallback("AlternateRule_UseUniversalAttributeBonus", onARUseUniversalAttributeBonusChanged)
    
    				displayACSystemUsed(AltRules.isUsingDescendingAC())
    				onARUniversalAttributeAverageRangeChanged()
    
    				--[[ Check to see if the sheet has the attributes in place already 
    				  before updating the fields. --]]	
    ...
    ...
    		<sheetdata>
    ...
    ...
    			<frame_char_switch_rolls name="cas3a" merge="replace">
    				<anchored>
    					<bottom parent="" anchor="bottom" />
    					<left parent="combatframe" anchor="left" />
    					<right parent="combatframe" anchor="right" />
    					<size>
    						<height>175</height>
    					</size>
    				</anchored>
    			</frame_char_switch_rolls>
    
    			<string_useredit_bold name="cas3a_label" source="cas3a_label">
    				<anchored to="cas3a" />
    				<default>Focuses</default>
    				<tooltip textres="label_editable_stats" />
    			</string_useredit_bold>
    			<!-- Code for draggable string rolls -->
    			<list_text name="cliroller3a">
    				<anchored to="cas3a">
    					<left offset="10" />
    					<top offset="30" />
    					<right offset="-4" />
    					<bottom offset="-10" />
    				</anchored>
    				<newfocus>name</newfocus>
    				<datasource>.clilist3a</datasource>
    				<class>cli_rolls</class>
    				<acceptdrop>
    					<class>cas</class>
    					<class>trackers</class>
    					<class>referencetextwide</class>
    					<field>*</field>
    				</acceptdrop>
    				</list_text>
    			<scrollbar_rolls name="scroll_3a">
    				<anchored to="cas3a" />
    				<target>cliroller3a</target>
    			</scrollbar_rolls>

    If I ***REMOVE***
    <list_text name="cliroller3a">

    Then it "works" (again - not having problems on FGC - so something changed...)
    ... runs off to try something...

    as DOES:
    <list_text name="cliroller3a" merge="replace">


    OK - here is where I always screw up... I need to YET_AGAIN(tm) reread that whole xml element and merge thing. I hate XML (cos I suck at this stuff)

    Removing my override (if that is right term) = success - but of course, doesn't have my changes anymore
    Nothing explicit = doesn't work FGU (works FGC)
    "join" = doesn't work FGU (didn't check FGC)
    "replace" = works FGU (didn't check FGC)
    "delete" made no sense to try


    Can anyone explain why/how so I can avoid this in future. I can port more of the code in either if helps for clarity.

  3. #3
    If you are using merging for a window class, then:
    For any controls are matched by template/control name and attribute name, the original control information and new control information is treated as if you had specified merge="join".
    If you want it to fully override the control, then you need to specify merge="replace".

    Regards,
    JPG

  4. #4
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    Yeah, I got it to work with replace, but I am unsure why this was:

    1. Working in FGC and not in FGU (did default change?)
    2. What about it needed replace, since if it said nothing “join” was assumed - what was being messed up to cause drag n drop to not work?

    (I feel I “fixed it” through trial and error vs understanding)

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
  •  
FG Spreadshirt Swag

Log in

Log in