-
January 26th, 2019, 14:56 #1
Accessing other window classes on the same tab
Greetings All,
This is something I know I've done, just can't remember where or how.
In my tab I have 3 window classes, 'char_abilities', 'char_skills' and 'char_health'
What I'm looking at doing is when rolling a Skill, access the 'char_abilities' window, so I can iterate through them and see if an attribute has been 'checked'.
Can someone help remove the fog from my mind please.
Thanks,
MBMRuleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
January 26th, 2019, 15:23 #2
- Join Date
- Jun 2013
- Location
- Isanti, MN
- Posts
- 2,922
Don't go through the windows, just access the DB directly.
-
January 26th, 2019, 15:25 #3
My recommendation, assuming the data is stored in the database, access the field/s you want in the database. It is better practice to access data in the database rather than the GUI. For a number of reasons - it’s easier to iterate through the data hierarchy, you’re dealing with the "master" data, you don’t have to cater for GUI and DB events, data may not be initialized in the GUI controls across all tabs in the PC sheet until you actually open that tab, the GUI tends to change more often than the DB (especially during development) so you have less code changes to make.
Last edited by Trenloe; January 26th, 2019 at 15:27.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
January 26th, 2019, 15:25 #4
Thought about that. Button_control is being used which doesn't save in the DB.
Here's the skill list, what I'm looking for is if another skill has been 'checked'.
Skillscheck.JPG
CheersRuleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
January 26th, 2019, 15:30 #5
So how does the data persist if you close FG? Or is the button not what you’re wanting to find out if it has been "checked"? In which case the button control not saving in the database is irrelevant - access the fields the "checks" are stored in.
EDIT: Start with window.getDatabaseNode in your button code. https://www.fantasygrounds.com/refdo...etDatabaseNodeLast edited by Trenloe; January 26th, 2019 at 15:34.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
January 26th, 2019, 15:39 #6
Chap,
The 'button_check' is not stored in the DB at all, I use /save during testing (rather than quitting/closing) and I use getDatabaseNode() for pulling the data (and then going parent etc to move up the DB tree).
This is why I wanted to access the actual GUI.
I've not written the base ruleset, I'm plugging in the scripting etc.
It seems as if '<buttoncontrol>' doesn't save in the DB. If it did, I could iterate through that.
CheersRuleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
January 26th, 2019, 15:43 #7
I did, and use nodeWin = window.getDatabaseNode() as I read Hunger dice etc. All works fine.
This is the XML 'saved':
Code:<athletics> <public /> <name type="string">Athletics</name> <order type="number">2</order> <skillrank type="number">2</skillrank> <skilltext type="formattedtext"> <p></p> </skilltext> <specialities type="string">Parkour</specialities> <specialties type="string">Parkour</specialties> <type type="string">Physical</type> </athletics>
Code:<button_attribute name="skill_check" source="skill_check"> <anchored> <top anchor="top" offset="-1" /> <right parent="name" anchor="left" offset="-16" /> <size width="12" height="12" /> </anchored> </button_attribute>
Ruleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
January 26th, 2019, 15:44 #8
So, I’ll ask again, is this a good feature? I assume you want the state of button_check to be persisted when FG is closed? If so, it needs to be stored in the database. Look at the examples of check buttons in other rulesets to see how they store data in the database.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
January 26th, 2019, 15:46 #9Ruleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
January 26th, 2019, 15:53 #10Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks