DICE PACKS BUNDLE
Page 2 of 2 First 12
  1. #11

    Join Date
    Jul 2010
    Location
    Germany, Frankfurt
    Posts
    156
    Quote Originally Posted by damned View Post
    Arent you just trying to store attribute info in the character sheet?
    This will be done without you adding a source on the subwindow as someone pointed out in the other thread.
    I want to create 7 subwindow on the main charactersheet subwindow. All 7 subwindows should use the same window class, which contains 4 field values (numberfields: current, max, used. bought).
    Because the values of a subwindow will stored on the containing record, which is the same for all 7 subwindow my approach does not work. so i need a way to set an individuell data source path for each subwindow, A working solution would be a windowlist. but there i have to create the childs dynamicly , what i dont want.
    the subwindow solution would be perfect if i could set data source path for its containing value fields.

  2. #12
    You can't do that through XML.

    For the XML, you can specify multiple subwindows that derive their data source from their parent windowclass (ala tabs on character sheet). For this approach, you can define individual window classes that provide the correct source location within the parent window class for each subwindow class. This is essentially what the default character sheet tabs do.

    If you really need to force subwindows to use different source locations than parent window; then you'll need to use the subwindow.setValue API.

    Regards,
    JPG

  3. #13
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    Can you post some pictures of what you are trying to build?
    What is the game system?

    Its most likely that what you want to achieve is already implemented (in a different way) in other rulesets.

  4. #14

    Join Date
    Jul 2010
    Location
    Germany, Frankfurt
    Posts
    156
    Quote Originally Posted by Moon Wizard View Post
    If you really need to force subwindows to use different source locations than parent window; then you'll need to use the subwindow.setValue API.
    Thanks, this brings me back to my last question/issue. If i do so, i got the issue that the value field control also creates a node for the subwindow contained record, because they were initialized before the "onInit" of the subwindow, where i used the "setValue" API to change the source path for it.
    I used the "fastinit" flag for the subwindow, maybe this caused that problem, i will check ...

    @damned
    I found ways to implement what i need, but i was looking for a more "smart" solution (especialy to realize it with the great ruleset wizard tool). The subwindow seams to be for me the solution which fits to my use case (you see all stats in the layout preview of the wizard, you only neet to implement all that logic for the numberfield only once in the window class of the subwindow, the label for the subwindows could be definded outside the subwindow and got automaticly a translateable string resource generated for it by the wizard), if it would work as i thought it would be.

    I am trying to create a simple "The dark Eye" ruleset (i know the is a good working MoreCore Solution for it also available).

  5. #15
    If you are trying to mirror the same controls for a bunch of stats, then you are talking about some sort of grouped templating system that can somehow be applied to multiple fields using some sort of prefix/suffix scheme, which FG doesn't do.

    If you look at any of the existing ruleset, attributes like you are talking about are all built using multiple controls (not subwindows); but use templates heavily to make the set of controls simpler. (Look at 3.5E campaign/record_char_main.xml in the charsheet_main window class.)

    Regards,
    JPG

  6. #16

  7. #17

    Join Date
    Jul 2010
    Location
    Germany, Frankfurt
    Posts
    156
    Yes, then that was probably just the wrong approach again (I learned programming many decades ago and probably don't get the "old" thinking out
    I will try it with templates, which is now also supported by the Ruleset Wizard.

    Thanks a lot for your help!

    UPDATE:

    Just for information, i got it work how i wanted to:

    I had to remove the "activate" and "fastinit" flag of the subwindow (set to FALSE in Ruselset Wizard) and add this onInit code for the subwindow:

    Code:
    function onInit()
    	local sClass, sDataSource = self.getValue();	
    	local sNodeName = sDataSource .. ".stats." .. self.getName();
    									
    	if not DB.findNode(sNodeName) then
    		DB.createNode(sNodeName);
    	end
    	
    	self.setValue(sClass, sNodeName);		
    	window[self.getName()].setEnabled(true);	
    	window[self.getName()].setVisible(true);	
    end
    This results into the db structure i did like to have:

    Code:
    	<charsheet>
    		<id-00001>
    ----
    			<stats>
    				<arcane_energie>
    					<boni_mali type="number">0</boni_mali>
    					<bought type="number">0</bought>
    					<max type="number">0</max>
    					<score type="number">0</score>
    					<used type="number">0</used>
    				</arcane_energie>
    				<dodge>
    					<boni_mali type="number">0</boni_mali>
    					<bought type="number">0</bought>
    					<max type="number">5</max>
    					<score type="number">5</score>
    					<used type="number">0</used>
    				</dodge>
    				<karma_points>
    					<boni_mali type="number">0</boni_mali>
    					<bought type="number">0</bought>
    					<max type="number">0</max>
    					<score type="number">0</score>
    					<used type="number">0</used>
    				</karma_points>
    				<life_points>
    					<boni_mali type="number">0</boni_mali>
    					<bought type="number">0</bought>
    					<max type="number">20</max>
    					<score type="number">20</score>
    					<used type="number">0</used>
    				</life_points>
    				<spirit>
    					<boni_mali type="number">0</boni_mali>
    					<bought type="number">0</bought>
    					<max type="number">5</max>
    					<score type="number">5</score>
    					<used type="number">0</used>
    				</spirit>
    				<toughness>
    					<boni_mali type="number">0</boni_mali>
    					<bought type="number">0</bought>
    					<max type="number">5</max>
    					<score type="number">5</score>
    					<used type="number">0</used>
    				</toughness>
    			</stats>
    ....
    		</id-00001>
    	</charsheet>
    Last edited by drvolk; July 11th, 2022 at 11: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
  •  
STAR TREK 2d20

Log in

Log in