-
July 10th, 2019, 21:06 #1
Adding Charsheet Tab - Injection?
Is there a way to 'inject' a new tab into the record_char class without re-writing the class in an extension?
Or if I have an extension with a new tab do I have to override the entire charsheet windowclass?
(Basically is there a way to add a tab without stepping on other extensions that might also want to alter the charsheet?)
Thanks,
Brandon
-
July 10th, 2019, 22:15 #2
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
If you are lucky and the other extension used merge features of templates you might be okay. However, I have not attempted this.
-
July 10th, 2019, 23:55 #3
Thanks - that pointed me in a direction to find the reference pages to look at. It's almost working but I'm having one issue -
When I use the template merge commands, the new tab is replacing the Main tab, and the new sub window is sitting on top of every window. I'm sure I have not understood how the merge functionality works.
I've tried various combinations of merge="merge" and merge="join" at different tabs/sub sheets as well as removing them all.
Code:<windowclass name="charsheet" merge="merge"> <sheetdata merge="join"> <sub_charsheet name="journal"> <class>charsheet_journal</class> </sub_charsheet> <tabs_charsheet merge="join"> <tab> <icon>tab_journal</icon> <subwindow>journal</subwindow> </tab> </tabs_charsheet> </sheetdata> </windowclass>
Code:<windowclass name="charsheet"> <frame>charsheet</frame> <placement> <size width="525" height="600" /> </placement> <sizelimits> <minimum width="525" height="570" /> <dynamic /> </sizelimits> <softclose /> <nodelete /> <playercontrol /> <minimize>minimized_char</minimize> <tooltip field="name" /> <script file="campaign/scripts/char.lua" /> <sheetdata> <anchor_title_charsheet name="contentanchor" /> <button_charactivate> <anchored to="contentanchor" position="belowright" offset="0,5" width="23" height="22" /> </button_charactivate> <token_char name="token"> <anchored to="contentanchor" position="belowright" offset="25,6" width="45" height="45" /> </token_char> <genericcontrol> <anchored to="contentanchor" position="belowleft" offset="5,5" width="45" height="45" /> <icon>charlist_base</icon> <disabled /> </genericcontrol> <portrait_charlocal name="localportrait"> <anchored to="contentanchor" position="belowleft" offset="5,5" width="45" height="45" /> <invisible /> </portrait_charlocal> <portrait_char name="portrait"> <anchored to="contentanchor" position="belowleft" offset="5,5" width="45" height="45" /> </portrait_char> <label_charframetop name="nametitle"> <anchored to="contentanchor" height="20"> <top anchor="bottom" offset="7" /> <left offset="65" /> <right offset="-135" /> </anchored> <static textres="char_label_name" /> </label_charframetop> <stringu name="name"> <anchored to="nametitle" position="insidetop" offset="0,25" height="20" /> </stringu> <label_charframetop name="inspirationtitle"> <anchored to="nametitle" position="righthigh" offset="20,0" width="30" height="20" /> <static textres="char_label_inspiration" /> <tooltip textres="char_tooltip_inspiration" /> </label_charframetop> <buttongroup_counter name="inspiration"> <anchored to="inspirationtitle"> <top anchor="bottom" offset="5" /> <left anchor="center" offset="-5" /> </anchored> <tooltip textres="char_tooltip_inspiration" /> <sourcefields><current>inspiration</current></sourcefields> <values><maximum>3</maximum></values> </buttongroup_counter> <sub_charsheet name="main"> <class>charsheet_main</class> </sub_charsheet> <sub_charsheet name="skills"> <class>charsheet_skills</class> </sub_charsheet> <sub_charsheet name="abilities"> <class>charsheet_abilities</class> </sub_charsheet> <sub_charsheet name="inventory"> <class>charsheet_inventory</class> </sub_charsheet> <sub_charsheet name="notes"> <class>charsheet_notes</class> </sub_charsheet> <sub_charsheet name="logs"> <class>charsheet_logs</class> </sub_charsheet> <sub_charsheet name="actions"> <class>charsheet_actions</class> </sub_charsheet> <sub_charsheet name="journal"> <class>charsheet_journal</class> </sub_charsheet> <tabs_charsheet> <tab> <icon>tab_main</icon> <subwindow>main</subwindow> </tab> <tab> <icon>tab_skills</icon> <subwindow>skills</subwindow> </tab> <tab> <icon>tab_abilities</icon> <subwindow>abilities</subwindow> </tab> <tab> <icon>tab_inventory</icon> <subwindow>inventory</subwindow> </tab> <tab> <icon>tab_notes</icon> <subwindow>notes</subwindow> </tab> <tab> <icon>tab_log</icon> <subwindow>logs</subwindow> </tab> <tab> <icon>tab_actions</icon> <subwindow>actions</subwindow> </tab> <tab> <icon>tab_journal</icon> <subwindow>journal</subwindow> </tab> <activate>1</activate> </tabs_charsheet> <close_charsheet /> <resize_charsheet /> </sheetdata> </windowclass>
Last edited by bmathis; July 11th, 2019 at 00:01.
-
July 11th, 2019, 02:26 #4
So this 'works' but it's not exactly what I was hoping for. I end up having to replace the whole tab section, but that's better than replacing the whole sheet I suppose.
Code:<windowclass name="charsheet" merge="join"> <sizelimits merge="replace"> <minimum width="525" height="570" /> <dynamic /> </sizelimits> <sheetdata> <sub_charsheet name="journal" insertafter="actions"> <class>charsheet_journal</class> </sub_charsheet> <tabs_charsheet merge="replace"> <tab> <icon>tab_main</icon> <subwindow>main</subwindow> </tab> <tab> <icon>tab_skills</icon> <subwindow>skills</subwindow> </tab> <tab> <icon>tab_abilities</icon> <subwindow>abilities</subwindow> </tab> <tab> <icon>tab_inventory</icon> <subwindow>inventory</subwindow> </tab> <tab> <icon>tab_notes</icon> <subwindow>notes</subwindow> </tab> <tab> <icon>tab_log</icon> <subwindow>logs</subwindow> </tab> <tab> <icon>tab_actions</icon> <subwindow>actions</subwindow> </tab> <tab> <icon>tab_journal</icon> <subwindow>journal</subwindow> </tab> <activate>1</activate> </tabs_charsheet> </sheetdata> </windowclass>
-
July 11th, 2019, 03:33 #5
You do have to replace the whole tab section and it will conflict with another extension if it is also overwriting the same section.
Savage Worlds did or does have a different tab method that supported multiple Tab adds from different sources but it was specific to that ruleset.
-
July 11th, 2019, 05:14 #6
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,559
You can only override/replace/merge a control in a window if it is named. I'm going to go through the rulesets I maintain (CoreRPG, 3.5E, 4E, 5E, C&C, CoC, Cypher, d20Mod) and add name="tabs" to all the tab control templates. This should allow you to more quickly add tabs without having to redefine window class. This will be included in the v3.3.8 update which is currently in beta testing in the next day or two.
Code:<windowclass name="charsheet" merge="join"> <sheetdata> <tabs_charsheet name="tabs"> <tab merge="add"> <icon>tab_journal</icon> <subwindow>journal</subwindow> </tab> </tabs_charsheet> </sheetdata> </windowclass>
JPG
-
July 11th, 2019, 05:27 #7Private 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!
-
July 11th, 2019, 07:19 #8
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,559
Great, you were on my list to contact (plus a couple other things I'm working on).
Cheers,
JPG
-
July 11th, 2019, 14:17 #9
-
July 11th, 2019, 14:26 #10
So this is a minor issue but it's bugging me - the new tab doesn't get the 'toptab' addition like the other tabs do.
It looks like this gets added in the buttongroup_tabs:OnInit function.
Since I'm merging/replacing in basically a new buttongroup in my extension - do I need to call that function again? Or does that run after the xml merge is complete?
I've uploaded an image to show what I'm talking about, look at the top of the 'Journal' tab and how it's not divided from the Actions tab. When I click on it it gets updated correctly to show it's the active tab, but when it de-activates it goes back to that.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks