View Full Version : Get Specific Tab
Mike Serfass
March 18th, 2024, 02:09
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:
win.combat
Now I have
<windowclass>
<tab merge="add">
<name>combat</name>
.....
How do I get the instance of the combat tab?
superteddy57
March 18th, 2024, 02:19
Same way as before. It creates a subwindow at that level with the name you used in your code block.
Moon Wizard
March 18th, 2024, 03:10
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
Mike Serfass
March 18th, 2024, 05:04
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.
superteddy57
March 18th, 2024, 06:19
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.
Trenloe
March 18th, 2024, 17:42
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.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.