PDA

View Full Version : Feature Request: Resizable Character Sheet With Contents Expanding To Fit Width



leozelig
March 28th, 2015, 13:27
I was able to create an extension that allows me to resize my character sheets for CoreRPG, but when I expand the width of the character sheet, the fields do not expand to fit the width of the sheet. I know that modifying the anchors will fix that, but I have not been able to identify which anchors to change.

CoreRPG has made some very nice improvements with the last few updates. I would love to see the character sheets become resizable in a future update, with fields that expand to fit the sheet width. In the meantime, if anyone knows which anchors I need to modify to make this happen, I can include that in my extension. Otherwise, just consider it a feature request! :)

damned
March 28th, 2015, 14:12
if your frame goes to teh right edge you can set the anchor to be something like -29 and that sets it to 29 pixels from the right edge.
You can do the same thing for the bottom edge.
For frames that do not end on the right and/or the bottom it is not very practical to resize the frame.

Does that help?
Ive got some stuff Im working on for DCC but as you say its getting close to FGCon... I also need to do my game prep so if you are ok with the current DCC changes for now...?

Trenloe
March 28th, 2015, 15:11
...but when I expand the width of the character sheet, the fields do not expand to fit the width of the sheet.

In the meantime, if anyone knows which anchors I need to modify to make this happen, I can include that in my extension.
As damned says, the right most window frames and controls are usually bound to the right hand edge so resizing width does result in these right hand frame/control resizing. These anchors are already there in standard CoreRPG - which specific fields are you referring to?


Otherwise, just consider it a feature request! :)
Add it to the feature request list: https://fg2app.idea.informer.com/

leozelig
March 28th, 2015, 18:20
Ive got some stuff Im working on for DCC but as you say its getting close to FGCon... I also need to do my game prep so if you are ok with the current DCC changes for now...?

Yes, definitely good for FG Con, thank you!

leozelig
March 28th, 2015, 18:29
Here is an example of my character sheet, minimum width and maximum width, but fields are fixed size.

I understand how anchoring works, but identifying which anchors to modify is like cracking a secret code! :)

9440 9441

Trenloe
March 28th, 2015, 22:57
Ah, OK - so you're referring to the column width for the attribute list. By default these lists are set with a specific column width (222 pixels in this case), if the windowlist control (https://www.fantasygrounds.com/refdoc/windowlist.xcp) is resized so that it's width allows for another column to be added, it will add another column with the same fixed width:

https://dl.dropboxusercontent.com/u/39085830/Screenshots/Fantasy%20Grounds/CoreRPG%20charsheet%20wide%201.jpg

If you want to dynamically change the width of the columns then you'll need to decide on a fixed number of columns - let's go with 2 in this case. Then, code needs to be written that detects when the window gets resized and changes the width of the columns using the setColumnWidth method based off the new width of the windowlist control: https://www.fantasygrounds.com/refdoc/windowlist.xcp#setColumnWidth

https://dl.dropboxusercontent.com/u/39085830/Screenshots/Fantasy%20Grounds/CoreRPG%20charsheet%20wide%202.jpg

The disadvantage if this is that if you have a lot of entries then resizing the width doesn't give you more columns, just two wider columns, and you'll have to resize the length (height) of the window or use the scrollbar. So, it's basically a design decision: dynamic width with a fixed number of columns, or dynamic number of columns with a fixed width.

To do the dynamic 2 column width resizing shown in the second screenshot above you'll need to modify the <template name="list_charmaincategory"> in campaign\template_char.xml as follows (code in red):


<template name="list_charmaincategory">
<windowlist>
<class>char_main_category</class>
<datasource>.maincategorylist</datasource>
<columns width="222" filldown="true" />
<allowcreate />
<allowdelete />
<sortby><field>label</field></sortby>
<script>
function onInit()
window.onSizeChanged = resizeColumns;
end

function resizeColumns()
local w, h = window.getSize();
setColumnWidth(math.floor(w/2)-40);
end

function onListChanged()
update();
end

function update()
local sEdit = getName() .. "_iedit";
if window[sEdit] then
local bEdit = (window[sEdit].getValue() == 1);
for _,wCategory in ipairs(getWindows()) do
wCategory.idelete.setVisibility(bEdit);
wCategory.attributes_iadd.setVisible(bEdit);
wCategory.attributes.update(bEdit);
end
end
end

function addEntry(bFocus)
local w = createWindow();
if bFocus then
w.header.subwindow.label.setFocus();
end
return w;
end
</script>
</windowlist>
</template>

damned
March 29th, 2015, 00:52
Nice - the three columns would be useful at times for sure!

leozelig
March 29th, 2015, 02:09
Thank you (again), Trenloe! I actually like the three columns, but I am going to experiment with a few things and see what I like.

leozelig
March 29th, 2015, 12:32
Ok, as I was playing around with the min/max sheet sizes, I noticed that if you minimize below a certain level, the columns drop from two to one, and the fields expand to fill the window. With a max of 750-800, it goes to three columns (but the field sizes don't change once it expands to two columns, interestingly). I really like the 3-column look actually. I did notice that the sheet will not split a section in two, so my thief character sheet has ~15 skills listed in the "Thief Skills" section and will not split into three columns. I'm going to make another section with the same name and divide up the list manually, which will fix that.

So, I changed the field size to 240 (from 222), because it was cutting off the last character of a few fields, and changed the min height/width to 500 and the max to 800. I liked the ability for the player to resize it to a format that they like (1-3 columns). That works fine for me - pretty darn close to having an actual ruleset really!

Once again, thank you for pointing me to the template_char file, Trenloe... Somehow I did not think to look there. :p

damned
March 29th, 2015, 12:39
So, I changed the field size to 240 (from 222)...
.... That works fine for me - pretty darn close to having an actual ruleset really!

You could also look at using a differnt font - 1px smaller to fit more characters in.
CoreRPG is far more flexible than most of have worked out :)



https://www.fg-con.com/wp-content/uploads/2015/01/fg-con-6-150-9.jpg (https://www.fg-con.com/events/)
FG Con 6 – April 17-19th 2015 - register at www.fg-con.com (https://www.fg-con.com/) for all the latest info.

greybeardgunner70
October 23rd, 2020, 14:39
Can you make the above adjustments to the length of the columns in FGU? Where would I do that? Does it require an extension or is there a template?

Trenloe
October 23rd, 2020, 14:56
Can you make the above adjustments to the length of the columns in FGU? Where would I do that? Does it require an extension or is there a template?
It should work the same in FGU. As you'd be changing ruleset code, you'd need an extension.

Note: the code referenced above could well have changed in the last 5 years, but the approach should be similar.

Moon Wizard
October 23rd, 2020, 18:16
Also, the character sheet in CoreRPG is already resize-able.

If you're layering changes on top for a ruleset or extension, you'll need to make sure that the anchoring and layout for your tab/subwindow are defined to support dynamic layout.

Regards,
JPG