-
July 19th, 2019, 03:49 #1
- Join Date
- Jun 2019
- Posts
- 71
Adding fields to record_item window
Looking over this for days and out of ideas. How would one insert additional fields in the item window? I can actually add the fields but not where I would like them to go. Example below.
I would like to add the "Item Type" cycler either into the first Section or it's own Section following the first. Here is the code I've done.
record_item.xml
Code:<windowclass name="item_main" merge="join"> <margins control="0,0,0,2" /> <script file="campaign/scripts/item_main.lua" /> <sheetdata> <anchor_column name="columnanchor" /> <label_column name="nonid_name_label"> <static textres="item_label_unidentified" /> </label_column> <string_columnh name="nonid_name" /> <label_column name="nonid_notes_label"> <static textres="item_label_unidentifiednotes" /> </label_column> <string_columnh name="nonid_notes" /> <line_column name="divider" /> <label_column name="item_type_label"> <static textres="item_type_group" /> </label_column> <item_cycler name="itemtype"> <anchored to="item_type_label" position="insidetopleft" offset="100,5" width="100" height="20" /> </item_cycler> <line_column name="divider2" /> <label_column name="cost_label"> <static textres="item_label_cost" /> </label_column> <string_columnh name="cost" /> <label_column name="weight_label"> <static textres="item_label_weight" /> </label_column> <number_columnh name="weight" /> <line_column name="divider3" /> <ft_columnh name="notes" /> </sheetdata> </windowclass>
Code:function update() local nodeRecord = getDatabaseNode(); local bReadOnly = WindowManager.getReadOnlyState(nodeRecord); local bID = LibraryData.getIDState("item", nodeRecord); local bSection1 = false; if User.isHost() then if updateControl("nonid_name", bReadOnly, true) then bSection1 = true; end; else updateControl("nonid_name", bReadOnly, false); end if (User.isHost() or not bID) then if updateControl("nonid_notes", bReadOnly, true) then bSection1 = true; end; else updateControl("nonid_notes", bReadOnly, false); end local bSection2 = false; if updateControl("itemtype", bReadOnly, bID) then bSection2 = true; end local bSection3 = false; if updateControl("cost", bReadOnly, bID) then bSection3 = true; end if updateControl("weight", bReadOnly, bID) then bSection3 = true; end local bSection4 = bID; notes.setVisible(bID); notes.setReadOnly(bReadOnly); divider.setVisible(bSection1 and bSection2); divider2.setVisible((bSection1 or bSection2) and bSection3); divider3.setVisible((bSection1 or bSection2 or bSection3) and bSection4); end
-
July 19th, 2019, 04:33 #2
At first blush that looks correct...
Where are you adding this code? In the ruleset or an extension? Do you have any other extensions active?
-
July 19th, 2019, 05:22 #3
- Join Date
- Jun 2019
- Posts
- 71
Thanks for the reply.
Adding in an extension, using the MoreCore ruleset, but there doesn't seem to be MC record_item, so I am extending the CoreRPG record_item.xml. No other extensions active.
-
July 19th, 2019, 05:48 #4
The record_item from corerpg is pretty basic - include the whole file and use merge="replace". See how that goes.
-
July 19th, 2019, 07:34 #5
- Join Date
- Jun 2019
- Posts
- 71
Did this, used merge="replace", reloaded FG and the console shot back an error: windowclass: Defined with unrecognized merge attribute value(replace)
-
July 19th, 2019, 08:02 #6
-
July 19th, 2019, 08:03 #7
It leave the merge attribute off altogether and it will replace.
-
July 19th, 2019, 08:13 #8
- Join Date
- Jun 2019
- Posts
- 71
Thanks, that worked (leaving off the merge).
Just for my reference, could you explain this:
The reason the above isn't working is because the anchoring is relative and you have not defined all of the fields which means that the ones you didn't drive are displaying before your new ones
Thanks again for your help, I appreciate it.
-
July 19th, 2019, 08:20 #9
Replacing the entire file you need to just put your entries in the right order with the other elements.
Like you did in your example. It's just the merge doesn't really work that well with those relative anchors.
-
July 19th, 2019, 08:38 #10
- Join Date
- Jun 2019
- Posts
- 71
Gotcha, thanks
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks