Thread: Specify subwindow datasource
-
July 9th, 2022, 21:57 #11
- Join Date
- Jul 2010
- Location
- Germany, Frankfurt
- Posts
- 156
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.
-
July 9th, 2022, 22:50 #12
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
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
-
July 10th, 2022, 03:00 #13
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.
-
July 10th, 2022, 08:12 #14
- Join Date
- Jul 2010
- Location
- Germany, Frankfurt
- Posts
- 156
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).
-
July 10th, 2022, 17:45 #15
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
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
-
July 10th, 2022, 23:57 #16
yes templates are the smart way to apply commonly reused layouts/functions.
-
July 11th, 2022, 05:48 #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
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