PDA

View Full Version : I just want a line of text on my sheet. Help wanted.



MooCow
December 22nd, 2019, 05:56
On top of my character sheet, I just want to have a line that says "Character Sheet".
(It's meant to go on every page, and so I put it in "record_char.xml".)
I do not want it inside a frame, since I don't want a border around it, and that's the tricky part. I know how to do it with a frame:

<frame_char name="charactersheetlabelframe">
<bounds>56,0,-54,45</bounds>
</frame_char>
<label_frametop>
<anchored to="charactersheetlabelframe" />
<static textres="char_label_character_sheet" />
</label_frametop>

...but "<static textres="char_label_character_sheet" />" doesn't work on its own.

Help!

MooCow
December 22nd, 2019, 07:00
Since it's possible that no such template exists within CoreRPG, I tried doing it without a template:


<stringcontrol name="charactersheetlabelframe">
<static>
<textres>char_label_character_sheet</textres>
</static>
<nodrag />
<nodrop />
<nodragselect />
</stringcontrol>

...but it says that I need to define a "vertical anchor", I guess to give the control a position on the sheet.
("Ruleset Error: window: No vertical anchor defined for control (charactersheetlabelframe) in windowclass (charsheet).")
How do I do that?

MooCow
December 22nd, 2019, 07:26
Okay, I've located the problem somewhat:

The CoreRPG character sheet uses the tag "<frame_char>".
This is a template tag defined in "template_char.xml" as a generic control with the frame tag "groupbox".
The frame "groupbox" is in turn defined in "graphics_frames.xml" as having a border graphic by default.
...so I can't use frame_char as a control for this particular label.
Looking around in template_char.xml, I'm not seeing any other templates that I can use.
Do I need to create my own template, or have I missed something?

Moon Wizard
December 22nd, 2019, 07:37
Stringcontrol is the basic non-database text control; and is used for all the record sheet labels.

Regards,
JPG

MooCow
December 22nd, 2019, 08:46
Stringcontrol is the basic non-database text control; and is used for all the record sheet labels.
Regards,
JPG

Okay, so at least I chose the right control, but the anchoring still remains.

In "template_common.xml" I found this snippet which seem to work:


<template name="label">
<stringcontrol>
<anchored height="20" />
<font>sheetlabel</font>
<nodrag />
<readonly />
</stringcontrol>
</template>
<template name="label_frametop">
<label>
<anchored position="insidetop" offset="0,10" />
<center />
</label>
</template>

...so if I assemble it together, I get this:


<frame name="charactersheetlabelframe">
<bounds>56,0,-54,45</bounds>
<stringcontrol name="charactersheetlabelcontrol">
<static textres="char_label_character_sheet" />
<anchored to="charactersheetlabelframe" position="insidetop" offset="0,10" height="20" />
<font>sheetlabel</font>
<nodrag />
<nodrop />
<nodragselect />
<readonly />
<center />
</stringcontrol>
</frame>

It has stopped generating anchor errors now, but the label doesn't show up.

MooCow
December 22nd, 2019, 08:56
Oh, I figured it out:

Frames seem to be for bitmaps, and they probably need to be defined as well (with "framedef").
I had no idea that I could put controls directly onto a window - I always thought that all visible content needed a frame to hold it.

For reference, this is the code that finally worked:


<stringcontrol>
<!-- <bounds>56,0,-54,45</bounds> -->
<static textres="char_label_character_sheet" />
<anchored position="insidetop" offset="0,10" height="20" />
<font>sheetlabel</font>
<nodrag />
<nodrop />
<nodragselect />
<readonly />
<center />
</stringcontrol>

Trenloe
December 22nd, 2019, 13:57
Are you aware of this Wiki resource? https://www.fantasygrounds.com/wiki/index.php/Developer_Guide

The "Interface" page gives a lot of information about building controls within the FG GUI.

MooCow
December 22nd, 2019, 17:17
Are you aware of this Wiki resource? https://www.fantasygrounds.com/wiki/index.php/Developer_Guide
The "Interface" page gives a lot of information about building controls within the FG GUI.
Thank you. I'll start reading it.
I've mostly been looking at the official reference documentation at https://www.fantasygrounds.com/refdoc/ and it's pretty barebones.
There's so many guides that it's been hard to know where to begin. I have occationally been to your link before, but Google gave me no links there for the search terms that I used. I have concentration issues where I can't read for long, or I'll zone out to flashbackland, so instead I'd rather just consult exactly what I want.

superteddy57
December 23rd, 2019, 23:43
A suggestion I was given a long time ago was to look over other available rulesets for examples of what I wanted in my project. Then hunt them down in the unpacked code of that ruleset. Helps get you comfortable searching through files and using examples that would be close to what you imagine it should look like. This did wonders for me as I am a more visual learner.

MooCow
December 24th, 2019, 08:08
A suggestion I was given a long time ago was to look over other available rulesets for examples of what I wanted in my project. Then hunt them down in the unpacked code of that ruleset. Helps get you comfortable searching through files and using examples that would be close to what you imagine it should look like. This did wonders for me as I am a more visual learner.
Yes, I'm doing that with CoreRPG (because I figured that it doesn't overwhelm me with features compared to other rulesets), and will look into other projects once I have space for them in my tabs list.