View Full Version : Creating a text box inside a pop up window
Druthlen
June 12th, 2019, 04:18
I have created a button. This button opens a window. It has a header but now I want to create a text box that automatically multilines. How do I do this?
what I have so far
<root>
<windowclass name="perceptionsheet">
<placement>
<size>
<width>500</width>
<height>300</height>
</size>
</placement>
<nodelete />
<playercontrol />
<sheetdata>
<genericcontrol name="perceptionframe">
<bounds>0,0,500,300</bounds>
<frame>
<name>storybox</name>
</frame>
</genericcontrol>
<stringcontrol name="perception_header">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>200,30</offset>
</anchored>
<center />
<static>Perception </static>
<font>narratorfont</font>
</stringcontrol>
<stringcontrol name="perception_desc1">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>15,50</offset>
</anchored>
<left />
<font>sheettextsmall</font>
<what do I do for text box??>
</stringcontrol>
<closebutton_charsheetmini />
</sheetdata>
</windowclass>
</root>
Moderator edit: Added code tags around code.
damned
June 12th, 2019, 11:37
Duplicate Notes or Story?
Druthlen
June 12th, 2019, 20:46
Notes
Druthlen
June 13th, 2019, 03:45
So I tried duplicating notes and it didn't work.
LordEntrails
June 13th, 2019, 04:30
I've never done anything like what you are doing, but I've followed enough on the forums and poked around the code enough to know you are going to have to duplicate the notes code and rename the objects in multiple places. Probably not just in a few xml files, but in some lua as well. And the files you need to modify probably exist in the CoreRPG ruleset along the the ruleset you are trying to modify. The usual suggestion is to use "find in files" from something like notepad++ for all the files in both rulesets and look for a unique object name.
But, as I've never duplicated a notes window, or anything similar, I could be totally off.
I can tell you though that just saying that you tried and it didn't work is not going to get you much help. In part because you are not explicitly asking for help, and in part because you haven't provided any details so someone can help you troubleshoot. Folks will need to know what files you have modified, and what code you have modified or added. At a minimum.
Trenloe
June 13th, 2019, 04:48
@Druthlen What exactly are you looking for - a multi-line string control (like the notes tab in the 5E PC sheet) or a formatted text control, like in a story window? If the latter, use a formattedtextcontrol: https://www.fantasygrounds.com/refdoc/formattedtextcontrol.xcp
Druthlen
June 13th, 2019, 23:33
So I copied story
<windowclass name="perceptionsheet">
<frame>storybox</frame>
<placement>
<size width="350" height="500" />
</placement>
<sizelimits>
<dynamic />
</sizelimits>
<minimize>minimized_encounter</minimize>
<playercontrol />
<sharable />
<nodelete />
<tooltip field="name" />
<sheetdata>
<sub_note_header name="header">
<class>encounter_header</class>
</sub_note_header>
<frame_story_content name="contentframe" />
<ft_record name="text">
<anchored to="contentframe" position="over" />
<footer>footer_wide</footer>
<empty textres="perc_desc" hidereadonly="true" />
</ft_record>
<scrollbar>
<anchored to="text" />
<target>text</target>
</scrollbar>
</sheetdata>
</windowclass>
<windowclass name="encounter_header">
<margins control="0,0,0,7" />
<script>
function onInit()
update();
end
function update()
local bReadOnly = WindowManager.getReadOnlyState(getDatabaseNode());
name.setReadOnly(bReadOnly);
end
</script>
<sheetdata>
<link_record_header>
<class>encounter</class>
</link_record_header>
<anchor_record_header_right name="rightanchor" />
<icon_record_locked />
<button_record_locked />
<stringfield name="name">
<anchored to="rightanchor" height="24">
<top offset="-4" />
<left parent="" offset="45" />
<right anchor="left" relation="relative" offset="-5" />
</anchored>
<font>reference-h</font>
<empty textres="perc_header" />
<nodrag />
<delaykeyupdate />
</stringfield>
</sheetdata>
</windowclass>>
</root>
So far it fills the empty space with the string I have declared. However, I cant figure out how to get a new line in a string and How would I fill that value instead of going with empty? Thanks for the help
damned
June 14th, 2019, 00:00
can you post an image (or three) of what you are trying to do?
Trenloe
June 14th, 2019, 00:26
Yeah, let us know what you're actually trying to do.
Druthlen
June 14th, 2019, 00:45
27573
So you see the character sheet. I want to add buttons that have info on the attributes. So far my button pops up. It has my window with a header. It has a section where I can type text in but I want to make that text automatic so I don't have to add it per character.
LordEntrails
June 14th, 2019, 05:45
Why not just use the link method from something like the 5E sheet where you can click on a class item and have the class entry open up? Same thing used with the items and everything else. Maybe that would be easier?
Druthlen
June 14th, 2019, 16:01
27582
I did it brute force
<windowclass name="perceptionsheet">
<placement>
<size>
<width>525</width>
<height>600</height>
</size>
</placement>
<nodelete />
<playercontrol />
<sheetdata>
<genericcontrol name="perceptionframe">
<bounds>0,0,525,600</bounds>
<frame>
<name>storybox</name>
</frame>
</genericcontrol>
<stringcontrol name="perception_header">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>220,30</offset>
</anchored>
<center />
<static>Perception </static>
<font>narratorfont</font>
</stringcontrol>
<stringcontrol name="perc_desc1">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>35,50</offset>
</anchored>
<left />
<font>sheettextsmall</font>
<static>Perception measures a character’s ability to observe his environment. This may </static>
</stringcontrol>
<stringcontrol name="perc_desc2">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>15,62</offset>
</anchored>
<left />
<font>sheettextsmall</font>
<static>involve a conscious effort, such as searching an area, but it is more often intuitive,</static>
</stringcontrol>
<stringcontrol name="perc_desc3">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>15,74</offset>
</anchored>
<left />
<font>sheettextsmall</font>
<static>as the character’s keen senses notice something out of the ordinary. Perception is</static>
</stringcontrol>
<stringcontrol name="perc_desc4">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>15,86</offset>
</anchored>
<left />
<font>sheettextsmall</font>
<static>a sensitivity to one’s surroundings, and is seldom present in the cynical or jaded</static>
</stringcontrol>
<stringcontrol name="perc_desc5">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>15,98</offset>
</anchored>
<left />
<font>sheettextsmall</font>
<static>(who have seen it all before).</static>
</stringcontrol>
<stringcontrol name="perc_desc6">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>35,110</offset>
</anchored>
<left />
<font>sheettextsmall</font>
<static>Perception is used to determine whether or not a character understands a given</static>
</stringcontrol>
<stringcontrol name="perc_desc7">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>15,122</offset>
</anchored>
<left />
<font>sheettextsmall</font>
<static>situation or detects an environmental stimulus. It can warn a character of ambushes,</static>
</stringcontrol>
<stringcontrol name="perc_desc8">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>15,134</offset>
</anchored>
<left />
<font>sheettextsmall</font>
<static>distinguish a clue from a pile of refuse, or uncover any other hidden or overlookable</static>
</stringcontrol>
<stringcontrol name="perc_desc9">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>15,146</offset>
</anchored>
<left />
<font>sheettextsmall</font>
<static>detail, whether physical or otherwise.</static>
</stringcontrol>
<stringcontrol name="perc_desc10">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>15,159</offset>
</anchored>
<left />
<font>narratorfont</font>
<static>Specialties: Attentive, Insightful, Careful, Discerning, Tactical</static>
</stringcontrol>
<closebutton_charsheetmini />
</sheetdata>
</windowclass>
My shame is great but I am happy. If anyone knows how to do this with less code please, teach me!
Moon Wizard
June 14th, 2019, 17:12
I've included a sample below of what it might look simplified a bit.
However, the main issue you are going to have is that you will not be able to distribute this ruleset, since it contains exact text blocks from the books. This is why people have been suggesting links or records previously.
In the 5E ruleset, when clicking on a skill entry, the code in the character sheet attempts to look up the link "reference.skills.<skillname>@*" in order to display the details of the skill. The data pack which contains the skill description is provided by the publisher as an official module. If no official module is available, then the link does not work, but a custom module can be created by the user. If you did something similar, you would also need to build skill or attribute records in order to reference.
My suggestion is to keep poking around like you are already doing in order to build something for yourself and learn more about how the FG interface works. You can always come back to change or refine later as you learn more.
Regards,
JPG
This code has not been tested, so it may need some adjustments.
<windowclass name="perceptionsheet">
<placement>
<size>
<width>300</width>
<height>300</height>
</size>
</placement>
<nodelete />
<sheetdata>
<genericcontrol name="perceptionframe">
<bounds>0,0,525,600</bounds>
<frame>
<name>storybox</name>
</frame>
</genericcontrol>
<stringcontrol name="perception_header">
<anchored>
<to>perceptionframe</to>
<position>insidetopleft</position>
<offset>220,30</offset>
</anchored>
<center />
<static>Perception </static>
<font>narratorfont</font>
</stringcontrol>
<stringcontrol name="perc_desc">
<anchored>
<to>perceptionframe</to>
<position>insidetop</position>
<offset>35,50</offset>
</anchored>
<multilinespacing>20</multilinespacing>
<font>sheettextsmall</font>
<static>Perception measures a character’s ability to observe his environment. This may involve a conscious effort, such as searching an area, but it is more often intuitive, as the character’s keen senses notice something out of the ordinary. Perception is a sensitivity to one’s surroundings, and is seldom present in the cynical or jaded (who have seen it all before).\rPerception is used to determine whether or not a character understands a given situation or detects an environmental stimulus. It can warn a character of ambushes, distinguish a clue from a pile of refuse, or uncover any other hidden or overlookable detail, whether physical or otherwise.\r\rSpecialties: Attentive, Insightful, Careful, Discerning, Tactical</static>
</stringcontrol>
<closebutton_charsheetmini />
</sheetdata>
</windowclass>
Hector Trelane
June 14th, 2019, 19:04
27573
So you see the character sheet. I want to add buttons that have info on the attributes. So far my button pops up. It has my window with a header. It has a section where I can type text in but I want to make that text automatic so I don't have to add it per character.
You can create a library mod with all the explanatory text, then drag links from the relevant windows to the corresponding spots on your character sheet. That approach is used in Savage Worlds, The One Ring, 5E...
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.