STAR TREK 2d20
  1. #1

    Join Date
    Sep 2020
    Location
    Ballston Lake, NY
    Posts
    608

    Get Specific Tab

    The latest changes introduced tabs.
    <sheetdata> holding multiple <subwindow_record> objects was replaced with multiple <tab> objects under <windowclass>.

    Previously, I could get a subwindow named "combat" with this, where win is a variable pointing at a window instance:
    Code:
    win.combat
    Now I have
    Code:
    <windowclass>
        <tab merge="add">
            <name>combat</name>
        .....
    How do I get the instance of the combat tab?

  2. #2
    Same way as before. It creates a subwindow at that level with the name you used in your code block.
    Dominic Morta
    Ruleset Developer
    Smiteworks

    How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it

    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Feature Request

  3. #3
    However, it does create them dynamically as needed. If you need to look up data, use the database instead or traversing the window/control tree.

    Regards,
    JPG

  4. #4

    Join Date
    Sep 2020
    Location
    Ballston Lake, NY
    Posts
    608
    Quote Originally Posted by superteddy57 View Post
    Same way as before. It creates a subwindow at that level with the name you used in your code block.
    I tried:
    win.combat
    win.tabs.combat
    win["combat"]

    Nothing I type in works. No name I use works.
    This is a tab put on the character sheet by the rule set. It's not something I added.
    I looked through the entire hierarchy and no name I try works.

    That makes it impossible to alter the underlying datasource as Moon Wizard suggests.

    Thanks for answering.

  5. #5
    All the fields created in the subwindow are connected to the database once it is initialized. So accessing it through the database is not reliant on accessing the subwindow.

    Example:
    I need the size of an NPC and it's in the combat subwindow and the code is running in the main subwindow.

    Use one
    local nodeRecord = getDatabaseNode() -- if in root
    local nodeRecord = window.getDatabaseNode(); -- if in control within windowclass;

    DB.getValue(nodeRecord, "size", "");

    This will pull the size and return an empty string if it returns nil. It might be best to provide more specific examples of what you are trying to accomplish to provide more detailed help as this is just a broad response.
    Dominic Morta
    Ruleset Developer
    Smiteworks

    How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it

    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Feature Request

  6. #6
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,470
    Quote Originally Posted by Mike Serfass View Post
    That makes it impossible to alter the underlying datasource as Moon Wizard suggests.
    I don't think Moon Wizard was suggesting altering the underlying datasource. He was suggesting going directly to the database to access data stored in the tab subwindows. The reason being that the subwindows are dynamic and not always initialized - so trying to access the subwindow with code outside of the scope of the subwindow will sometimes (or maybe always) fail.

    Usually I would use window.combat.subwindow to access the subwindow control of a tabbed subwindow in a character sheet - where window is the top level of the character sheet (windowclass="charsheet") - although I haven't specifically tested this in v4.5.x. But, as mentioned, this subwindow may not always exist, so if you're looking for the underlying data it's best to go to the database. Of course, if you're trying to do GUI activities against the subwindow, you'll only be able to do that if the subwindow exists.
    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
  •  
DICE PACKS BUNDLE

Log in

Log in