View Full Version : window header or replacement for button_record_locked
rmilmine
March 5th, 2026, 22:57
I'm trying to figure out what to replace button_record_locked with?
I saw somewhere that there is a new window header template, but I can't seem to find any documentation.
I could go digging into corerpg, or one of the other rulesets, but time to research it is limited.
Thanks,
Robert
Moon Wizard
March 6th, 2026, 01:13
Look at windowclass name="quest" for the simplest version; or windowclass name="battle" for a slightly more complex version; or windowclass name="charsheet" or "npc" for the most advanced versions.
Basically, all the record window and record header components have been componentized, so they're simpler to implement the common record type scenarios.
Regards,
JPG
rmilmine
March 6th, 2026, 01:48
Thank you.
I take it then I would create a template off of one of those in order to add an icon to it?
Robert.
LordEntrails
March 6th, 2026, 03:32
You should be able to just find the one that has everything you want, then create the same windowclass with a merge=join and add to it.
LordEntrails
March 6th, 2026, 03:37
Here's one I'm part way cleaning up. Instead of defining my text with bounds, I could be using insertbefore or anchors and it would be cleaner, but I haven't gotten that far yet. Here are two examples you can draw from.
<?xml version="1.0" encoding="utf-8"?>
<root>
<windowclass name="sub_ct_header_client" merge="join">
<sheetdata>
<stringcontrol name="label_init">
<bounds>10191,2,30,20</bounds>
<tooltip textres="sub_ct_header_client_label_init_Tooltip" />
<underline />
<static textres="sub_ct_header_client_label_init_LabelCaption" />
<font>sheetlabel</font>
<readonly />
</stringcontrol>
<stringcontrol name="label_bp">
<bounds>10229,2,30,20</bounds>
<tooltip textres="sub_ct_header_client_label_bp_Tooltip" />
<underline />
<static textres="sub_ct_header_client_label_bp_LabelCaption" />
<font>sheetlabel</font>
<readonly />
</stringcontrol>
<stringcontrol name="label_wounds">
<bounds>10257,2,30,20</bounds>
<tooltip textres="sub_ct_header_client_label_wounds_Tooltip" />
<underline />
<static textres="sub_ct_header_client_label_wounds_LabelCaption" />
<font>sheetlabel</font>
<readonly />
</stringcontrol>
<stringcontrol name="label_map">
<bounds>10292,2,30,20</bounds>
<tooltip textres="sub_ct_header_client_label_map_Tooltip" />
<underline />
<static textres="sub_ct_header_client_label_map_LabelCaption" />
<font>sheetlabel</font>
<readonly />
</stringcontrol>
</sheetdata>
</windowclass>
</root>
Or a partial:
<?xml version="1.0" encoding="utf-8"?>
<root>
<windowclass name="ct_entry" merge="join">
<sheetdata>
<stringfield name="name" merge="join">
<anchored>
<right parent="rightanchor" offset="-150" relation="relative" />
</anchored>
<controlline />
<lineoffset>-2</lineoffset>
</stringfield>
<stringfield name="nonid_name" merge="join">
<anchored>
<right parent="rightanchor" offset="-150" relation="relative" />
</anchored>
<invisible />
<controlline />
<lineoffset>-2</lineoffset>
</stringfield>
<button_ct_section_defense name="button_section_defense" merge="join" insertbefore="button_section_space">
<anchored>
<right parent="rightanchor" offset="0" relation="relative" />
</anchored>
</button_ct_section_defense>
<button_ct_section_active name="button_section_active" merge="join" insertbefore="button_section_space">
<anchored>
<right parent="rightanchor" offset="0" relation="relative" />
</anchored>
</button_ct_section_active>
rmilmine
March 6th, 2026, 13:58
I was able to get a simple header working.
A more complex one based on the npc sheet is giving me trouble.
I got the npc sheet to work after much head banging, but... I can't seem to get a button to add to the header.
I also can't find a way to reference any of the buttons on the header. I'm guessing it's because I'm putting it on the wrong window.
When I looked at the windowclass record_header I do not see any buttons on it, or any templates that it has.
I used /debug on to find the names of the buttons, but It says that they don't exist when I try to insert before or after any of them.
rmilmine
March 6th, 2026, 15:57
I found the menu manager.
Now more things to figure out.
LordEntrails
March 6th, 2026, 17:06
If you post some details and perhaps some code, I will try and go through it. I'm not even much of a hack, but have been doing similar things lately so might be able to figure out the issue for you.
rmilmine
March 6th, 2026, 17:49
I think I actually figured it out.
At first I tried putting the code in my window, but it complained that the anchorright didn't exist.
So I looked at the what the npc sheet was doing the copy with, record_window_tabbed.
Where I found a template being used called, windowmenubar_recordsheet.
Looking at that template I found windowmenubar.
Which then led me to the window class windowmenubar.
This window class has an anchor, and code calling the window menu managers populate function.
I did the following:
<windowclass name="windowmenubar" merge="join">
<script>
function onInit()
if super and super.onInit then
super.onInit();
end
WindowMenuManagerXCore.populate(self);
end
</script>
</windowclass>
and then created my own window menu manager with:
function onTabletopInit()
WindowMenuManagerXCore.registerToolbarButtons();
end
function registerToolbarButtons()
ToolbarManager.registerButton("recalculate",
{
sType = "action",
sIcon = "icon_cog",
sTooltipRes = "charsheet_recalculate_ButtonCaption",
fnActivate = WindowMenuManagerXCore.performRecalculate,
});
end
function populate(w)
if not w then
return;
end
local wTop = WindowManager.getTopWindow(w);
if wTop.windowmenu and wTop.windowmenu[1].simple then
return;
end
local sRecordType = RecordDataManager.getRecordTypeFromWindow(wTop);
if sRecordType == "npc" then
local tRightButtons = {};
table.insert(tRightButtons, "");
table.insert(tRightButtons, "recalculate");
ToolbarManager.addList(w, tRightButtons, "right");
end
end
Now I just need to replicate this with the character sheet.
I noticed that windowclass has a function, registerMenuItem
Could I use this instead of what I did above? If so, how would it be used?
pindercarl
March 6th, 2026, 18:28
I think I actually figured it out.
At first I tried putting the code in my window, but it complained that the anchorright didn't exist.
So I looked at the what the npc sheet was doing the copy with, record_window_tabbed.
Where I found a template being used called, windowmenubar_recordsheet.
Looking at that template I found windowmenubar.
Which then led me to the window class windowmenubar.
This window class has an anchor, and code calling the window menu managers populate function.
I did the following:
<windowclass name="windowmenubar" merge="join">
<script>
function onInit()
if super and super.onInit then
super.onInit();
end
WindowMenuManagerXCore.populate(self);
end
</script>
</windowclass>
and then created my own window menu manager with:
function onTabletopInit()
WindowMenuManagerXCore.registerToolbarButtons();
end
function registerToolbarButtons()
ToolbarManager.registerButton("recalculate",
{
sType = "action",
sIcon = "icon_cog",
sTooltipRes = "charsheet_recalculate_ButtonCaption",
fnActivate = WindowMenuManagerXCore.performRecalculate,
});
end
function populate(w)
if not w then
return;
end
local wTop = WindowManager.getTopWindow(w);
if wTop.windowmenu and wTop.windowmenu[1].simple then
return;
end
local sRecordType = RecordDataManager.getRecordTypeFromWindow(wTop);
if sRecordType == "npc" then
local tRightButtons = {};
table.insert(tRightButtons, "");
table.insert(tRightButtons, "recalculate");
ToolbarManager.addList(w, tRightButtons, "right");
end
end
Now I just need to replicate this with the character sheet.
I noticed that windowclass has a function, registerMenuItem
Could I use this instead of what I did above? If so, how would it be used?
registerMenuItem is for adding items to the right-click menu.
rmilmine
March 6th, 2026, 20:30
Thank you. If I had properly read the description of the function I would have seen that.
rtfm correctly for me.
rmilmine
March 6th, 2026, 22:42
I have two templates in the same file.
Both are used on the character sheet multiple times.
For some reason one works and the other says it's not found. There are no errors when loading. just a warning that the template couldn't be found.
template xml
<template name="stat_set_button">
<buttoncontrol>
<allowdoubleclick />
<icon normal="icon_cog" pressed="icon_cog_down" />
<script file="campaign/scripts/stat_set_button.lua"/>
</buttoncontrol>
</template>
template usage code
<stat_set_button name="n1_set">
<anchored>
<left anchor="center" offset="-28" />
<right anchor="center" offset="-12" />
<top offset="0" anchor="top" parent="n1" relation="current" />
<size>
<height>16</height>
</size>
</anchored>
<textres>charsheet_main_n1_set_ButtonCaption</textres>
</stat_set_button>
Anyone see what is wrong? May be I've just been looking at this stuff too much today. lol
Thanks,
Robert
rmilmine
March 7th, 2026, 01:57
Thanks for the help, both of you! It directed me where I needed to look.
Not sure what was going on with that template above, but it's now working.
LordEntrails
March 8th, 2026, 04:00
Good to hear it's working. I couldn't figure out what was wrong :)
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.