FG Spreadshirt Swag
Page 1 of 2 12 Last
  1. #1
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620

    Some Windowlist problems...

    I have a few small problems with a Windowlist I am using in my character-sheet.

    First one would be that there is no description to the values if I drag them from the list... (And while I have the feeling that this is probably pretty EASY to fix... I haven't been able to figure it out. )

    The second is more of a oddity, but I think it'd be easy to do a work-around.
    If I create several empty lines, the numbers associated with them are not associated. And when I change one, others change as well. I imagine this has to do partially with the sorting algorithm and partially with the index for a blank line.

    Either way... Is there any way to surpress the adding of new blank lines when you allready have one?

    And finally... How to add all the XP costs together for it all to work properly?


    Code:
    <windowclass name="charsheet_skilllistitem">
    			<sizelimits>
    				<minimum>
    					<height>18</height>
    				</minimum>
    			</sizelimits>
    		<script file="scripts/charsheet_skilllistitem.lua" />
    		<sheetdata>
    			
    			<stringfield name="label">
    				<anchored>
    					<left>
    						<anchor>left</anchor>
    						<offset>15</offset>
    					</left>
    					<top>
    						<anchor>top</anchor>
    						<offset>5</offset>
    					</top>
    					<size>
    						<width>180</width>
    					</size>
    				</anchored>
    				
    				<font>sheetlabelsmall</font>
    				<frame>
    					<name>textline</name>
    					<offset>0,5,0,0</offset>
    				</frame>
    				<script>
    					function onEnter()
    						window.windowlist.addNewInstance(window.label.getValue());
    					end
    					
    					function onDeleteUp()
    						if getValue() == "" and window.ranks.getValue() == 0 then
    							local target = window.windowlist.getPrevWindow(window);
    							if target and target.label.getValue() == window.label.getValue() then
    								target.sublabel.setFocus();
    							end
    							
    							window.getDatabaseNode().delete();
    						end
    					end
    				</script>
    			</stringfield>
    			<numberfield name="skill.level">
    			<anchored>
    					<left>
    						<anchor>left</anchor>
    						<offset>200</offset>
    					</left>
    					<top>
    						<anchor>top</anchor>
    						<offset>2</offset>
    					</top>
    					<size>
    						<width>25</width>
    					</size>
    				</anchored>
    				<script>
    						function onValueChanged()
    							local test;
    							local cost;
    							cost = window.getDatabaseNode().getChild("skill.cost").getValue() 
    							test = window.getDatabaseNode().getChild("skill.level").getValue() 
    								window.getDatabaseNode().getChild("skill.xp").setValue( cost*((test^2)/2 +(test/2)) );
    						end
    						
    					
    					function onEnter()
    						window.windowlist.addNewInstance(window.label.getValue());
    					end
    					
    						
    				</script>
    				<stateframe>
    					<hover>
    						<name>sheetfocus</name>
    						<offset>6,7,7,5</offset>
    					</hover>
    					<drophilight>
    						<name>rowshade</name>
    						<offset>1,1,1,1</offset>
    					</drophilight>
    				</stateframe>
    			</numberfield>
    			
    			<numberfield name="skill.cost">
    			<anchored>
    					<left>
    						<anchor>left</anchor>
    						<offset>230</offset>
    					</left>
    					<top>
    						<anchor>top</anchor>
    						<offset>2</offset>
    					</top>
    					<size>
    						<width>25</width>
    					</size>
    				</anchored>
    				<script>
    						function onValueChanged()
    							local test;
    							local cost;
    							cost = window.getDatabaseNode().getChild("skill.cost").getValue() 
    							test = window.getDatabaseNode().getChild("skill.level").getValue() 
    								window.getDatabaseNode().getChild("skill.xp").setValue( cost*((test^2)/2 +(test/2)) );
    						end
    						
    					function onEnter()
    						window.windowlist.addNewInstance(window.label.getValue());
    					end
    						
    				</script>
    				<stateframe>
    					<hover>
    						<name>sheetfocus</name>
    						<offset>6,7,7,5</offset>
    					</hover>
    					<drophilight>
    						<name>rowshade</name>
    						<offset>1,1,1,1</offset>
    					</drophilight>
    				</stateframe>
    			</numberfield>
    			
    			<numberfield name="skill.xp">
    			<anchored>
    					<left>
    						<anchor>left</anchor>
    						<offset>260</offset>
    					</left>
    					<top>
    						<anchor>top</anchor>
    						<offset>2</offset>
    					</top>
    					<size>
    						<width>25</width>
    					</size>
    				</anchored>
    			<stateframe>
    					<hover>
    						<name>sheetfocus</name>
    						<offset>6,7,7,5</offset>
    					</hover>
    					<drophilight>
    						<name>rowshade</name>
    						<offset>1,1,1,1</offset>
    					</drophilight>
    				</stateframe>
    			</numberfield>
    			
    		</sheetdata>
    	</windowclass>
    And then later on the Sheet i call it up with

    Code:
     <windowlist name="skilllist">
    				<bounds rect="25,200,700,250" />
    				<datasource>.skilllist</datasource>
    				<class>charsheet_skilllistitem</class>
    				<allowcreate />
    				<columns>
    					<filldown />
    					<width>350</width>
    				</columns>
    				<script file="scripts/charsheet_skilllist.lua" />
    			</windowlist>
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  2. #2
    Ok first thing I would change is how you have the numberfields.

    I would change:
    <numberfield name="skill.level">

    to
    <numberfield name="skilllevel" source="skill.level">

    This may be why they are all changing at the same time because I don't think the dot qualifiers are allowed in a name but in the source (i.e. the database) this will group them like you want.

    In the windowlist control a <skipempty /> tag will prevent if from creating the default blank lines.

    Also to get drag and drop working the easiest, your field names from the items you are trying to drop should be the same as the receiving control. Then add the following in the windowlist control (if your class you are dropping it from is called skill):
    Code:
    <acceptdrop>
        <class>skill</class>
        <field>label</field>
        <field>skilllevel</field>
    </acceptdrop>

  3. #3
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620
    The last problem is more when I drag from the list to the modifier box or chatbox... It will take the level, but not the name.

    So the roll becomes nothing but a digit with no annotation on how it ended up so.
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  4. #4
    In the numberfield put this:
    Code:
    <description>
        <field>label</field>
    </description>
    That will make it use the label field for the description text when dragged. Alternative you can use a <text> tag instead of <field> if you wanted to hard code something but usually in a list thats not what is intended.

  5. #5
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620
    THAT did the trick.

    Thank you EVER so much Joshua.
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  6. #6
    Foen's Avatar
    Join Date
    Jan 2007
    Location
    Suffolk, England
    Posts
    2,007
    You mentioned in your OP that the name was copied across but not the description. I can't see a description field in the list item windowclass, but if it is formattedtext then you will probably have some difficulties: I don't think formattedtext fields can be copied - least not that I can discover.

    Cheers

    Stuart

  7. #7
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620
    Hmmmm...

    A secondary question about the description field? Can several values be added to it?

    As in the names from Two fields/labels?
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  8. #8
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620
    Quote Originally Posted by Foen
    You mentioned in your OP that the name was copied across but not the description. I can't see a description field in the list item windowclass, but if it is formattedtext then you will probably have some difficulties: I don't think formattedtext fields can be copied - least not that I can discover.

    Cheers

    Stuart
    The name IS the description. Hmm... and for some reason, it didn't work... Agh...
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  9. #9
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620
    Quote Originally Posted by joshuha
    In the numberfield put this:
    Code:
    <description>
        <field>label</field>
    </description>
    That will make it use the label field for the description text when dragged. Alternative you can use a <text> tag instead of <field> if you wanted to hard code something but usually in a list thats not what is intended.
    ... funnily this doesn't seem to work within Windowlists?
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  10. #10
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620
    .... nor did adding this to the script.

    Code:
    function onDrag(button, x, y, draginfo)
    					     draginfo.setDescription(window.getDatabaseNode().getChild("label").getValue());
    					end

    Gee and I am painfully reminded that I am by NO means a competent LUA coder...
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

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
  •  
Starfinder Playlist

Log in

Log in