STAR TREK 2d20
  1. #1

    XML sorting issue

    Anyone know why this code is sorting my spells?

    Code:
    	<windowclass name="spelllist">
    		<datasource name="spells" />
    		<frame name="referencebox" />
    		<dynamic resize="vertical" />
    		<defaultsize width="640" height="550" />
    		<minimize icon="minimized_reference" />
    		<tooltip field="description" />
    		<sheetdata>
    			<windowopencontrol>
    				<icon normal="button_dragtarget" />
    				<bounds rect="25,20,20,20" />
    				<class name="spelllist" />
    				<description field="description" />
    			</windowopencontrol>
    			<stringcontrol name="description">
    				<bounds rect="50,20,-25,20" />
    			</stringcontrol>
    			<windowlist class="spellsmall">
    				<bounds rect="35,48,-20,-22" />
    				<nestdata />
    			</windowlist>
    			<scroller>
    				<bounds rect="-63,-45,45,27" />
    				<target name="list" />
    				<button normal="button_scroller" pressed="button_scroller_down" />
    			</scroller>
    		</sheetdata>
    	</windowclass>

  2. #2
    I doubt this has anything to do with the sorting but the scroller is not linked to the windowlist. The windowlist needs a name as below:
    Code:
                <windowlist class="spellsmall" name="list" >
                    <bounds rect="35,48,-20,-22" />
                    <nestdata />
                </windowlist>
                <scroller>
                    <bounds rect="-63,-45,45,27" />
                    <target name="list" />
                    <button normal="button_scroller" pressed="button_scroller_down" />
                </scroller>
    Without a specific sort node in the windowlist the spells should be appearing in the order that the spell nodes have been defined in the xml (which is in alphabetical order?)

  3. #3
    Quote Originally Posted by Toadwart
    Without a specific sort node in the windowlist the spells should be appearing in the order that the spell nodes have been defined in the xml (which is in alphabetical order?)
    No, they are not in alphabetical order. If they were in alphabetical order how could I tell that it was sorting them?

    Since it referances spellsmall could something there be sorting it?

    Code:
    <windowclass name="spellsmall">
    		<datasource name="spell" />
    		<defaultsize width="600" height="20" />
    		<sheetdata>
    			<windowopencontrol name="open">
    				<icon normal="button_openwindow" pressed="button_emptytarget" />
    				<bounds rect="8,0,24,24" />
    				<class name="spelldesc" />
    				<description field="name" />
    			</windowopencontrol>
    			<stringcontrol name="name">
    				<bounds rect="50,2,300,17" />
    				<font name="chatfont" />
    				<link handler="open" />
    			</stringcontrol>			
    			<stringcontrol name="shortdescription">
    				<bounds rect="200,2,360,17" />
    				<font name="chatfont" />
    			</stringcontrol>
    		</sheetdata>
    	</windowclass>
    Last edited by Ganadai; April 26th, 2006 at 15:06.

  4. #4
    Unless there is some default sorting thet FG is applying I can't see why that code would be sorting your spells.
    What field is it sorting by? Name? Description?

  5. #5
    I beleive the reason everything is getting sorted for you is this:

    The xml that is parsed is parsed based on alphabetical order, based on the order of the letters in each node that the window class is referenced to. You can see this clearly when you are looking at encounters in the db.xml files. Even though each "node" has a unique identifier, the parser will sort in ascending alphabetical order. (I.E. 1, 10, 11, 12... 2, 20, 21 etc.)

    It can be a pain in the arse sometimes, but if you do not want to have your list sorted in descending order, then you can try and add something to the title to make it so it does not sort.

    Hope that helps,

    Sandeman
    Ultimate Licence holder

    I've had FG for so LONG I DON'T KNOW HOW TO USE IT!

    But I'm learning!

  6. #6
    Quote Originally Posted by Toadwart
    Unless there is some default sorting thet FG is applying I can't see why that code would be sorting your spells.
    What field is it sorting by? Name? Description?
    It is sorting by name.

  7. #7
    Quote Originally Posted by kalmarjan
    I beleive the reason everything is getting sorted for you is this:

    The xml that is parsed is parsed based on alphabetical order, based on the order of the letters in each node that the window class is referenced to. You can see this clearly when you are looking at encounters in the db.xml files. Even though each "node" has a unique identifier, the parser will sort in ascending alphabetical order. (I.E. 1, 10, 11, 12... 2, 20, 21 etc.)

    It can be a pain in the arse sometimes, but if you do not want to have your list sorted in descending order, then you can try and add something to the title to make it so it does not sort.

    Hope that helps,

    Sandeman
    LOL why are you always answering my questions?
    Anyways, thank you, that worked. I just changed the node names to 01, 02, 03, 04...
    Last edited by Ganadai; April 28th, 2006 at 06:21.

  8. #8
    I am always glad to help... <err> get my post count up! (Legitimately, that is!)

    Sandeman

    BTW, that will work until you get to 100, then the silly issue will start all over again. I wonder if there is a way to put the xml tag <sort="descending" /> ?
    Ultimate Licence holder

    I've had FG for so LONG I DON'T KNOW HOW TO USE IT!

    But I'm learning!

  9. #9
    Quote Originally Posted by kalmarjan
    I am always glad to help... <err> get my post count up! (Legitimately, that is!)

    Sandeman

    BTW, that will work until you get to 100, then the silly issue will start all over again. I wonder if there is a way to put the xml tag <sort="descending" /> ?
    That would not help either, I'd need a tag like:
    <sort="none" />

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
  •  
5E Character Create Playlist

Log in

Log in