DICE PACKS BUNDLE
Page 1 of 2 12 Last
  1. #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,
    MBM
    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!

  2. #2

    Join Date
    Jun 2013
    Location
    Isanti, MN
    Posts
    2,922
    Don't go through the windows, just access the DB directly.

  3. #3
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    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!

  4. #4
    Quote Originally Posted by Andraax View Post
    Don't go through the windows, just access the DB directly.
    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

    Cheers
    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!

  5. #5
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    Quote Originally Posted by MadBeardMan View Post
    Thought about that. Button_control is being used which doesn't save in the DB.
    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...etDatabaseNode
    Last 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!

  6. #6
    Quote Originally Posted by Trenloe View Post
    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...etDatabaseNode
    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.

    Cheers
    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!

  7. #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>
    No sign of the 'skill_check' that's part of the skill list

    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>
    So to address these issues, why aren't the buttoncontrols saving in the DB?
    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!

  8. #8
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    Quote Originally Posted by MadBeardMan View Post
    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).
    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!

  9. #9
    Quote Originally Posted by Trenloe View Post
    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.
    No I don't want them stored, they're a 'one' off, ie you check a skill, roll another skill and it adds the 2 skill levels together. Once the roll is made, all checks are cleared.
    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!

  10. #10
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    OK. Thanks for clarifying.

    Tabs are usually created as subwindow GUI entities. You'll need to navigate the subwindow hierarchy. Do a search in a ruleset like 3.5E for .subwindow to see some examples.
    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!

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